mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Remove rudimentary mentions of "magic" in RIP-7560 related code
This commit is contained in:
parent
80242b7199
commit
faecd257d6
2 changed files with 3 additions and 14 deletions
|
|
@ -57,7 +57,7 @@ func abiDecodeAcceptAccount(input []byte) (*AcceptAccountData, error) {
|
||||||
if methodSelector == SigFailAccountMethodSig {
|
if methodSelector == SigFailAccountMethodSig {
|
||||||
return nil, errors.New("account signature error")
|
return nil, errors.New("account signature error")
|
||||||
}
|
}
|
||||||
return nil, errors.New("account did not return correct MAGIC_VALUE")
|
return nil, errors.New("account did not call the EntryPoint 'acceptAccount' callback")
|
||||||
}
|
}
|
||||||
acceptAccountData := &AcceptAccountData{}
|
acceptAccountData := &AcceptAccountData{}
|
||||||
err = jsonAbi.UnpackIntoInterface(acceptAccountData, "acceptAccount", input[4:])
|
err = jsonAbi.UnpackIntoInterface(acceptAccountData, "acceptAccount", input[4:])
|
||||||
|
|
@ -71,7 +71,7 @@ func abiDecodeAcceptPaymaster(input []byte) (*AcceptPaymasterData, error) {
|
||||||
}
|
}
|
||||||
methodSelector := new(big.Int).SetBytes(input[:4]).Uint64()
|
methodSelector := new(big.Int).SetBytes(input[:4]).Uint64()
|
||||||
if methodSelector != AcceptPaymasterMethodSig {
|
if methodSelector != AcceptPaymasterMethodSig {
|
||||||
return nil, errors.New("paymaster did not return correct MAGIC_VALUE")
|
return nil, errors.New("paymaster did not call the EntryPoint 'acceptPaymaster' callback")
|
||||||
}
|
}
|
||||||
acceptPaymasterData := &AcceptPaymasterData{}
|
acceptPaymasterData := &AcceptPaymasterData{}
|
||||||
err = jsonAbi.UnpackIntoInterface(acceptPaymasterData, "acceptPaymaster", input[4:])
|
err = jsonAbi.UnpackIntoInterface(acceptPaymasterData, "acceptPaymaster", input[4:])
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
"github.com/status-im/keycard-go/hexutils"
|
"github.com/status-im/keycard-go/hexutils"
|
||||||
"math/big"
|
"math/big"
|
||||||
"slices"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -158,7 +157,7 @@ func returnWithData(data []byte) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAccountCode() []byte {
|
func createAccountCode() []byte {
|
||||||
return returnWithData(core.PackValidationData(core.AcceptAccountMethodSig, 0, 0))
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// create EVM code from OpCode, byte and []bytes
|
// create EVM code from OpCode, byte and []bytes
|
||||||
|
|
@ -202,13 +201,3 @@ func createCode(items ...interface{}) []byte {
|
||||||
func asBytes32(a int) []byte {
|
func asBytes32(a int) []byte {
|
||||||
return common.LeftPadBytes(big.NewInt(int64(a)).Bytes(), 32)
|
return common.LeftPadBytes(big.NewInt(int64(a)).Bytes(), 32)
|
||||||
}
|
}
|
||||||
|
|
||||||
func paymasterReturnValue(magic, validUntil, validAfter uint64, context []byte) []byte {
|
|
||||||
validationData := core.PackValidationData(magic, validUntil, validAfter)
|
|
||||||
//manual encode (bytes32 validationData, bytes context)
|
|
||||||
return slices.Concat(
|
|
||||||
common.LeftPadBytes(validationData, 32),
|
|
||||||
asBytes32(64),
|
|
||||||
asBytes32(len(context)),
|
|
||||||
context)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue