diff --git a/mock/context/blockChainHookStub.go b/mock/context/blockChainHookStub.go index 11f9794f6..118008103 100644 --- a/mock/context/blockChainHookStub.go +++ b/mock/context/blockChainHookStub.go @@ -11,20 +11,25 @@ var _ vmcommon.BlockchainHook = (*BlockchainHookStub)(nil) // BlockchainHookStub is used in tests to check that interface methods were called type BlockchainHookStub struct { - NewAddressCalled func(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error) - GetStorageDataCalled func(accountsAddress []byte, index []byte) ([]byte, uint32, error) - GetBlockHashCalled func(nonce uint64) ([]byte, error) - LastNonceCalled func() uint64 - LastRoundCalled func() uint64 - LastTimeStampCalled func() uint64 - LastRandomSeedCalled func() []byte - LastEpochCalled func() uint32 - GetStateRootHashCalled func() []byte - CurrentNonceCalled func() uint64 - CurrentRoundCalled func() uint64 - CurrentTimeStampCalled func() uint64 - CurrentRandomSeedCalled func() []byte - CurrentEpochCalled func() uint32 + NewAddressCalled func(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error) + GetStorageDataCalled func(accountsAddress []byte, index []byte) ([]byte, uint32, error) + GetBlockHashCalled func(nonce uint64) ([]byte, error) + LastNonceCalled func() uint64 + LastRoundCalled func() uint64 + LastTimeStampCalled func() uint64 + LastRandomSeedCalled func() []byte + LastEpochCalled func() uint32 + GetStateRootHashCalled func() []byte + CurrentNonceCalled func() uint64 + CurrentRoundCalled func() uint64 + CurrentTimeStampCalled func() uint64 + CurrentRandomSeedCalled func() []byte + CurrentEpochCalled func() uint32 + RoundTimeCalled func() uint64 + EpochStartBlockTimeStampCalled func() uint64 + EpochStartBlockNonceCalled func() uint64 + EpochStartBlockRoundCalled func() uint64 + ProcessBuiltInFunctionCalled func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) GetBuiltinFunctionNamesCalled func() vmcommon.FunctionNames GetAllStateCalled func(address []byte) (map[string][]byte, error) @@ -153,6 +158,38 @@ func (b *BlockchainHookStub) CurrentEpoch() uint32 { return 0 } +// RoundTime mocked method +func (b *BlockchainHookStub) RoundTime() uint64 { + if b.RoundTimeCalled != nil { + return b.RoundTimeCalled() + } + return 0 +} + +// EpochStartBlockTimeStamp mocked method +func (b *BlockchainHookStub) EpochStartBlockTimeStamp() uint64 { + if b.EpochStartBlockTimeStampCalled != nil { + return b.EpochStartBlockTimeStampCalled() + } + return 0 +} + +// EpochStartBlockNonce mocked method +func (b *BlockchainHookStub) EpochStartBlockNonce() uint64 { + if b.EpochStartBlockNonceCalled != nil { + return b.EpochStartBlockNonceCalled() + } + return 0 +} + +// EpochStartBlockRound VMHooks implementation. +func (b *BlockchainHookStub) EpochStartBlockRound() uint64 { + if b.EpochStartBlockRoundCalled != nil { + return b.EpochStartBlockRoundCalled() + } + return 0 +} + // ProcessBuiltInFunction mocked method func (b *BlockchainHookStub) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) { if b.ProcessBuiltInFunctionCalled != nil { diff --git a/vmhost/mock/blockchainContextMock.go b/vmhost/mock/blockchainContextMock.go index 854958ab7..6017b7de7 100644 --- a/vmhost/mock/blockchainContextMock.go +++ b/vmhost/mock/blockchainContextMock.go @@ -105,6 +105,26 @@ func (b *BlockchainContextMock) CurrentTimeStamp() uint64 { return 0 } +// RoundTime - +func (b *BlockchainContextMock) RoundTime() uint64 { + return 0 +} + +// EpochStartBlockTimeStamp - +func (b *BlockchainContextMock) EpochStartBlockTimeStamp() uint64 { + return 0 +} + +// EpochStartBlockNonce - +func (b *BlockchainContextMock) EpochStartBlockNonce() uint64 { + return 0 +} + +// EpochStartBlockRound - +func (b *BlockchainContextMock) EpochStartBlockRound() uint64 { + return 0 +} + // CurrentRandomSeed - func (b *BlockchainContextMock) CurrentRandomSeed() []byte { return bytes.Repeat([]byte{1}, 32)