mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-03-13 21:15:17 +00:00
Compare commits
1 Commits
899c17ceb3
...
40b11ae046
Author | SHA1 | Date | |
---|---|---|---|
![]() |
40b11ae046 |
@ -4,5 +4,4 @@ const (
|
||||
ErrGetStateDB = "get EVM StateDB failed"
|
||||
ErrInvalidNumberOfArgs = "invalid number of arguments; expected %d; got: %d"
|
||||
ErrSenderNotOrigin = "msg.sender is not from tx origin"
|
||||
ErrWriteOnReadOnly = "read only call to write functions"
|
||||
)
|
||||
|
@ -92,17 +92,6 @@ func (d *DASignersPrecompile) RequiredGas(input []byte) uint64 {
|
||||
return RequiredGasMax
|
||||
}
|
||||
|
||||
func (d *DASignersPrecompile) IsTx(method string) bool {
|
||||
switch method {
|
||||
case DASignersFunctionUpdateSocket,
|
||||
DASignersFunctionRegisterSigner,
|
||||
DASignersFunctionRegisterNextEpoch:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Run implements vm.PrecompiledContract.
|
||||
func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error) {
|
||||
// parse input
|
||||
@ -117,10 +106,6 @@ func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly b
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// readonly check
|
||||
if readonly && d.IsTx(method.Name) {
|
||||
return nil, fmt.Errorf(precopmiles_common.ErrWriteOnReadOnly)
|
||||
}
|
||||
// get state db and context
|
||||
stateDB, ok := evm.StateDB.(*statedb.StateDB)
|
||||
if !ok {
|
||||
|
@ -67,20 +67,6 @@ func (s *StakingPrecompile) RequiredGas(input []byte) uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (s *StakingPrecompile) IsTx(method string) bool {
|
||||
switch method {
|
||||
case StakingFunctionCreateValidator,
|
||||
StakingFunctionEditValidator,
|
||||
StakingFunctionDelegate,
|
||||
StakingFunctionBeginRedelegate,
|
||||
StakingFunctionUndelegate,
|
||||
StakingFunctionCancelUnbondingDelegation:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Run implements vm.PrecompiledContract.
|
||||
func (s *StakingPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error) {
|
||||
// parse input
|
||||
@ -95,10 +81,6 @@ func (s *StakingPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly boo
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// readonly check
|
||||
if readonly && s.IsTx(method.Name) {
|
||||
return nil, fmt.Errorf(precopmiles_common.ErrWriteOnReadOnly)
|
||||
}
|
||||
// get state db and context
|
||||
stateDB, ok := evm.StateDB.(*statedb.StateDB)
|
||||
if !ok {
|
||||
|
Loading…
Reference in New Issue
Block a user