diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-13 18:20:22 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:22 +0800 |
commit | ae057d8eaa31d30d0eebce6e8b76dad368b4a72d (patch) | |
tree | a948d00b6ffbd7c9ea62a70426959da7951c2952 /core/vm/oracle_contracts_test.go | |
parent | 43457d6a008524f9dd353fce7b12e16cd4d0e157 (diff) | |
download | go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar.gz go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar.bz2 go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar.lz go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar.xz go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.tar.zst go-tangerine-ae057d8eaa31d30d0eebce6e8b76dad368b4a72d.zip |
core: vm: create new oracle contract instance in each call (#251)
Since the VM might be called from different source (downloader, RPC,
etc.). We need to make the call state separate. Modify the calling
sequence so a new oracle contract instance is used on each run.
Diffstat (limited to 'core/vm/oracle_contracts_test.go')
-rw-r--r-- | core/vm/oracle_contracts_test.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/vm/oracle_contracts_test.go b/core/vm/oracle_contracts_test.go index f8f327a68..0b8b7b4f7 100644 --- a/core/vm/oracle_contracts_test.go +++ b/core/vm/oracle_contracts_test.go @@ -195,7 +195,11 @@ func (g *OracleContractsTestSuite) SetupTest() { } func (g *OracleContractsTestSuite) TearDownTest() { - OracleContracts[GovernanceContractAddress].(*GovernanceContract).coreDKGUtils = &defaultCoreDKGUtils{} + OracleContracts[GovernanceContractAddress] = func() OracleContract { + return &GovernanceContract{ + coreDKGUtils: &defaultCoreDKGUtils{}, + } + } } func (g *OracleContractsTestSuite) newPrefundAccount() (*ecdsa.PrivateKey, common.Address) { @@ -936,7 +940,11 @@ func (g *OracleContractsTestSuite) TestResetDKG() { mock := &testCoreMock{ tsigReturn: true, } - OracleContracts[GovernanceContractAddress].(*GovernanceContract).coreDKGUtils = mock + OracleContracts[GovernanceContractAddress] = func() OracleContract { + return &GovernanceContract{ + coreDKGUtils: mock, + } + } // Fill data for previous rounds. roundHeight := int64(g.config.RoundLength) |