From a4a9a49a767e1fa33db89255e42eb802e1290764 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 11 Feb 2021 19:20:38 +0300 Subject: [PATCH] [#49] Remove trigger check from contracts This check was useful when there was a single entry point in contract. But right now there is no point in this. Signed-off-by: Alex Vanin --- alphabet/alphabet_contract.go | 8 +------- audit/audit_contract.go | 4 ---- balance/balance_contract.go | 4 ---- container/container_contract.go | 4 ---- neofs/neofs_contract.go | 7 ------- neofsid/neofsid_contract.go | 8 +------- netmap/netmap_contract.go | 4 ---- reputation/reputation_contract.go | 4 ---- 8 files changed, 2 insertions(+), 41 deletions(-) diff --git a/alphabet/alphabet_contract.go b/alphabet/alphabet_contract.go index 9c3a9ae..2cbd9b7 100644 --- a/alphabet/alphabet_contract.go +++ b/alphabet/alphabet_contract.go @@ -20,15 +20,9 @@ const ( voteKey = "ballots" ) -var ( - ctx storage.Context -) +var ctx storage.Context func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() } diff --git a/audit/audit_contract.go b/audit/audit_contract.go index ac9666c..36f2599 100644 --- a/audit/audit_contract.go +++ b/audit/audit_contract.go @@ -43,10 +43,6 @@ const ( var ctx storage.Context func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() } diff --git a/balance/balance_contract.go b/balance/balance_contract.go index fcaa905..2ea2178 100644 --- a/balance/balance_contract.go +++ b/balance/balance_contract.go @@ -59,10 +59,6 @@ func CreateToken() Token { } func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() token = CreateToken() } diff --git a/container/container_contract.go b/container/container_contract.go index e9d671b..733d4d3 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -56,10 +56,6 @@ var ( ) func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() } diff --git a/neofs/neofs_contract.go b/neofs/neofs_contract.go index ca2a1ad..557adcc 100644 --- a/neofs/neofs_contract.go +++ b/neofs/neofs_contract.go @@ -80,14 +80,7 @@ var ( ) func init() { - // The trigger determines whether this smart-contract is being - // run in 'verification' or 'application' mode. - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() - } // Init set up initial inner ring node keys. diff --git a/neofsid/neofsid_contract.go b/neofsid/neofsid_contract.go index 95cae24..344e3ea 100644 --- a/neofsid/neofsid_contract.go +++ b/neofsid/neofsid_contract.go @@ -21,15 +21,9 @@ const ( containerContractKey = "containerScriptHash" ) -var ( - ctx storage.Context -) +var ctx storage.Context func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() } diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index 21203f4..974591d 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -52,10 +52,6 @@ var ( ) func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() } diff --git a/reputation/reputation_contract.go b/reputation/reputation_contract.go index 043d1a0..dbfea7a 100644 --- a/reputation/reputation_contract.go +++ b/reputation/reputation_contract.go @@ -25,10 +25,6 @@ var ( ) func init() { - if runtime.GetTrigger() != runtime.Application { - panic("contract has not been called in application node") - } - ctx = storage.GetContext() }