mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
Merge branch 'master' into upgrade_blobpool
This commit is contained in:
commit
344720f94e
254 changed files with 11614 additions and 1920 deletions
|
|
@ -1,8 +1,13 @@
|
|||
on:
|
||||
schedule:
|
||||
- cron: '0 15 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
### Note we cannot use cron-triggered builds right now, Gitea seems to have
|
||||
### a few bugs in that area. So this workflow is scheduled using an external
|
||||
### triggering mechanism and workflow_dispatch.
|
||||
#
|
||||
# schedule:
|
||||
# - cron: '0 15 * * *'
|
||||
|
||||
jobs:
|
||||
azure-cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
on:
|
||||
schedule:
|
||||
- cron: '0 16 * * *'
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
### Note we cannot use cron-triggered builds right now, Gitea seems to have
|
||||
### a few bugs in that area. So this workflow is scheduled using an external
|
||||
### triggering mechanism and workflow_dispatch.
|
||||
#
|
||||
# schedule:
|
||||
# - cron: '0 16 * * *'
|
||||
|
||||
|
||||
jobs:
|
||||
ppa:
|
||||
name: PPA Upload
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ on:
|
|||
- "master"
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
linux-intel:
|
||||
|
|
@ -25,7 +26,7 @@ jobs:
|
|||
|
||||
- name: Build (amd64)
|
||||
run: |
|
||||
go run build/ci.go install -arch amd64 -dlgo
|
||||
go run build/ci.go install -static -arch amd64 -dlgo
|
||||
|
||||
- name: Create/upload archive (amd64)
|
||||
run: |
|
||||
|
|
@ -37,7 +38,7 @@ jobs:
|
|||
|
||||
- name: Build (386)
|
||||
run: |
|
||||
go run build/ci.go install -arch 386 -dlgo
|
||||
go run build/ci.go install -static -arch 386 -dlgo
|
||||
|
||||
- name: Create/upload archive (386)
|
||||
run: |
|
||||
|
|
@ -67,7 +68,7 @@ jobs:
|
|||
|
||||
- name: Build (arm64)
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
|
||||
go run build/ci.go install -static -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
|
||||
|
||||
- name: Create/upload archive (arm64)
|
||||
run: |
|
||||
|
|
@ -79,7 +80,7 @@ jobs:
|
|||
|
||||
- name: Run build (arm5)
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "5"
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ jobs:
|
|||
|
||||
- name: Run build (arm6)
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "6"
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ jobs:
|
|||
|
||||
- name: Run build (arm7)
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "7"
|
||||
|
||||
|
|
@ -121,6 +122,37 @@ jobs:
|
|||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
windows:
|
||||
name: Windows Build
|
||||
runs-on: "win-11"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
# Note: gcc.exe only works properly if the corresponding bin/ directory is
|
||||
# contained in PATH.
|
||||
|
||||
- name: "Build (amd64)"
|
||||
shell: cmd
|
||||
run: |
|
||||
set PATH=%GETH_MINGW%\bin;%PATH%
|
||||
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_MINGW%\bin\gcc.exe
|
||||
env:
|
||||
GETH_MINGW: 'C:\msys64\mingw64'
|
||||
|
||||
- name: "Build (386)"
|
||||
shell: cmd
|
||||
run: |
|
||||
set PATH=%GETH_MINGW%\bin;%PATH%
|
||||
go run build/ci.go install -dlgo -arch 386 -cc %GETH_MINGW%\bin\gcc.exe
|
||||
env:
|
||||
GETH_MINGW: 'C:\msys64\mingw32'
|
||||
|
||||
docker:
|
||||
name: Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
|
@ -29,5 +29,5 @@ miner/ @MariusVanDerWijden @fjl @rjl493456442
|
|||
node/ @fjl
|
||||
p2p/ @fjl @zsfelfoldi
|
||||
rlp/ @fjl
|
||||
params/ @fjl @karalabe @gballet @rjl493456442 @zsfelfoldi
|
||||
params/ @fjl @gballet @rjl493456442 @zsfelfoldi
|
||||
rpc/ @fjl
|
||||
|
|
|
|||
36
.github/workflows/go.yml
vendored
36
.github/workflows/go.yml
vendored
|
|
@ -1,18 +1,20 @@
|
|||
name: i386 linux tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: self-hosted
|
||||
runs-on: self-hosted-ghr
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
# Cache build tools to avoid downloading them each time
|
||||
- uses: actions/cache@v4
|
||||
|
|
@ -23,7 +25,7 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23.0
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Run linters
|
||||
|
|
@ -32,17 +34,25 @@ jobs:
|
|||
go run build/ci.go check_generate
|
||||
go run build/ci.go check_baddeps
|
||||
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
test:
|
||||
name: Test
|
||||
needs: lint
|
||||
runs-on: self-hosted-ghr
|
||||
strategy:
|
||||
matrix:
|
||||
go:
|
||||
- '1.24'
|
||||
- '1.23'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24.0
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: false
|
||||
|
||||
- name: Run tests
|
||||
run: go test -short ./...
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: 386
|
||||
run: go test ./...
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
var (
|
||||
intRegex = regexp.MustCompile(`(u)?int([0-9]*)`)
|
||||
)
|
||||
|
||||
func isKeyWord(arg string) bool {
|
||||
switch arg {
|
||||
case "break":
|
||||
|
|
@ -299,7 +303,7 @@ func bindBasicType(kind abi.Type) string {
|
|||
case abi.AddressTy:
|
||||
return "common.Address"
|
||||
case abi.IntTy, abi.UintTy:
|
||||
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String())
|
||||
parts := intRegex.FindStringSubmatch(kind.String())
|
||||
switch parts[2] {
|
||||
case "8", "16", "32", "64":
|
||||
return fmt.Sprintf("%sint%s", parts[1], parts[2])
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) {
|
|||
}
|
||||
// Set this environment variable to regenerate the test outputs.
|
||||
if os.Getenv("WRITE_TEST_FILES") != "" {
|
||||
if err := os.WriteFile((fname), []byte(have), 0666); err != nil {
|
||||
if err := os.WriteFile(fname, []byte(have), 0666); err != nil {
|
||||
t.Fatalf("err writing expected output to file: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ var (
|
|||
|
||||
{{range .Calls}}
|
||||
// Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x{{printf "%x" .Original.ID}}.
|
||||
// the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: {{.Original.String}}
|
||||
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
|
||||
|
|
@ -101,6 +102,15 @@ var (
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: {{.Original.String}}
|
||||
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) {
|
||||
return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
|
||||
}
|
||||
|
||||
{{/* Unpack method is needed only when there are return args */}}
|
||||
{{if .Normalized.Outputs }}
|
||||
{{ if .Structured }}
|
||||
|
|
@ -133,8 +143,7 @@ var (
|
|||
outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
return *outstruct, err
|
||||
{{else}}
|
||||
return *outstruct, nil{{else}}
|
||||
if err != nil {
|
||||
return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err
|
||||
}
|
||||
|
|
@ -145,8 +154,8 @@ var (
|
|||
out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err
|
||||
{{- end}}
|
||||
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil
|
||||
{{- end}}
|
||||
}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
|
|||
}
|
||||
|
||||
// PackTest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd7a5aba2.
|
||||
// the contract method with ID 0xd7a5aba2. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function test(function callback) returns()
|
||||
func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
|
||||
|
|
@ -62,3 +63,12 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
|
|||
}
|
||||
return enc
|
||||
}
|
||||
|
||||
// TryPackTest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd7a5aba2. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function test(function callback) returns()
|
||||
func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) {
|
||||
return callbackParam.abi.Pack("test", callback)
|
||||
}
|
||||
|
|
|
|||
111
accounts/abi/abigen/testdata/v2/crowdsale.go.txt
vendored
111
accounts/abi/abigen/testdata/v2/crowdsale.go.txt
vendored
|
|
@ -64,7 +64,8 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f
|
|||
}
|
||||
|
||||
// PackAmountRaised is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7b3e5e7b.
|
||||
// the contract method with ID 0x7b3e5e7b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function amountRaised() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackAmountRaised() []byte {
|
||||
|
|
@ -75,6 +76,15 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAmountRaised is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7b3e5e7b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function amountRaised() returns(uint256)
|
||||
func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("amountRaised")
|
||||
}
|
||||
|
||||
// UnpackAmountRaised is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x7b3e5e7b.
|
||||
//
|
||||
|
|
@ -85,11 +95,12 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackBeneficiary is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x38af3eed.
|
||||
// the contract method with ID 0x38af3eed. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function beneficiary() returns(address)
|
||||
func (crowdsale *Crowdsale) PackBeneficiary() []byte {
|
||||
|
|
@ -100,6 +111,15 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackBeneficiary is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x38af3eed. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function beneficiary() returns(address)
|
||||
func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("beneficiary")
|
||||
}
|
||||
|
||||
// UnpackBeneficiary is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x38af3eed.
|
||||
//
|
||||
|
|
@ -110,11 +130,12 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro
|
|||
return *new(common.Address), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01cb3b20.
|
||||
// the contract method with ID 0x01cb3b20. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function checkGoalReached() returns()
|
||||
func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
|
||||
|
|
@ -125,8 +146,18 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackCheckGoalReached is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01cb3b20. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function checkGoalReached() returns()
|
||||
func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("checkGoalReached")
|
||||
}
|
||||
|
||||
// PackDeadline is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x29dcb0cf.
|
||||
// the contract method with ID 0x29dcb0cf. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function deadline() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackDeadline() []byte {
|
||||
|
|
@ -137,6 +168,15 @@ func (crowdsale *Crowdsale) PackDeadline() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDeadline is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x29dcb0cf. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function deadline() returns(uint256)
|
||||
func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("deadline")
|
||||
}
|
||||
|
||||
// UnpackDeadline is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x29dcb0cf.
|
||||
//
|
||||
|
|
@ -147,11 +187,12 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackFunders is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc0d3dff.
|
||||
// the contract method with ID 0xdc0d3dff. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
|
||||
func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
|
||||
|
|
@ -162,6 +203,15 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFunders is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc0d3dff. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
|
||||
func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) {
|
||||
return crowdsale.abi.Pack("funders", arg0)
|
||||
}
|
||||
|
||||
// FundersOutput serves as a container for the return parameters of contract
|
||||
// method Funders.
|
||||
type FundersOutput struct {
|
||||
|
|
@ -181,12 +231,12 @@ func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) {
|
|||
}
|
||||
outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
|
||||
outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackFundingGoal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7a3a0e84.
|
||||
// the contract method with ID 0x7a3a0e84. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function fundingGoal() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackFundingGoal() []byte {
|
||||
|
|
@ -197,6 +247,15 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFundingGoal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7a3a0e84. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function fundingGoal() returns(uint256)
|
||||
func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("fundingGoal")
|
||||
}
|
||||
|
||||
// UnpackFundingGoal is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x7a3a0e84.
|
||||
//
|
||||
|
|
@ -207,11 +266,12 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackPrice is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa035b1fe.
|
||||
// the contract method with ID 0xa035b1fe. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function price() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackPrice() []byte {
|
||||
|
|
@ -222,6 +282,15 @@ func (crowdsale *Crowdsale) PackPrice() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackPrice is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa035b1fe. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function price() returns(uint256)
|
||||
func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("price")
|
||||
}
|
||||
|
||||
// UnpackPrice is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xa035b1fe.
|
||||
//
|
||||
|
|
@ -232,11 +301,12 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackTokenReward is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6e66f6e9.
|
||||
// the contract method with ID 0x6e66f6e9. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function tokenReward() returns(address)
|
||||
func (crowdsale *Crowdsale) PackTokenReward() []byte {
|
||||
|
|
@ -247,6 +317,15 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTokenReward is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6e66f6e9. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function tokenReward() returns(address)
|
||||
func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) {
|
||||
return crowdsale.abi.Pack("tokenReward")
|
||||
}
|
||||
|
||||
// UnpackTokenReward is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x6e66f6e9.
|
||||
//
|
||||
|
|
@ -257,7 +336,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro
|
|||
return *new(common.Address), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract.
|
||||
|
|
|
|||
206
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
206
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
|
|
@ -64,7 +64,8 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe
|
|||
}
|
||||
|
||||
// PackChangeMembership is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9644fcbd.
|
||||
// the contract method with ID 0x9644fcbd. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
|
||||
func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte {
|
||||
|
|
@ -75,8 +76,18 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool,
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackChangeMembership is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9644fcbd. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
|
||||
func (dAO *DAO) TryPackChangeMembership(targetMember common.Address, canVote bool, memberName string) ([]byte, error) {
|
||||
return dAO.abi.Pack("changeMembership", targetMember, canVote, memberName)
|
||||
}
|
||||
|
||||
// PackChangeVotingRules is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbcca1fd3.
|
||||
// the contract method with ID 0xbcca1fd3. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
|
||||
func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte {
|
||||
|
|
@ -87,8 +98,18 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackChangeVotingRules is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbcca1fd3. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
|
||||
func (dAO *DAO) TryPackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) ([]byte, error) {
|
||||
return dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority)
|
||||
}
|
||||
|
||||
// PackCheckProposalCode is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xeceb2945.
|
||||
// the contract method with ID 0xeceb2945. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
|
||||
func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte {
|
||||
|
|
@ -99,6 +120,15 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackCheckProposalCode is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xeceb2945. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
|
||||
func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) {
|
||||
return dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode)
|
||||
}
|
||||
|
||||
// UnpackCheckProposalCode is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xeceb2945.
|
||||
//
|
||||
|
|
@ -109,11 +139,12 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x69bd3436.
|
||||
// the contract method with ID 0x69bd3436. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function debatingPeriodInMinutes() returns(uint256)
|
||||
func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
|
||||
|
|
@ -124,6 +155,15 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x69bd3436. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function debatingPeriodInMinutes() returns(uint256)
|
||||
func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) {
|
||||
return dAO.abi.Pack("debatingPeriodInMinutes")
|
||||
}
|
||||
|
||||
// UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x69bd3436.
|
||||
//
|
||||
|
|
@ -134,11 +174,12 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackExecuteProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x237e9492.
|
||||
// the contract method with ID 0x237e9492. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
|
||||
func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte {
|
||||
|
|
@ -149,6 +190,15 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackExecuteProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x237e9492. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
|
||||
func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) {
|
||||
return dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode)
|
||||
}
|
||||
|
||||
// UnpackExecuteProposal is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x237e9492.
|
||||
//
|
||||
|
|
@ -159,11 +209,12 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackMajorityMargin is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaa02a90f.
|
||||
// the contract method with ID 0xaa02a90f. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function majorityMargin() returns(int256)
|
||||
func (dAO *DAO) PackMajorityMargin() []byte {
|
||||
|
|
@ -174,6 +225,15 @@ func (dAO *DAO) PackMajorityMargin() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMajorityMargin is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaa02a90f. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function majorityMargin() returns(int256)
|
||||
func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) {
|
||||
return dAO.abi.Pack("majorityMargin")
|
||||
}
|
||||
|
||||
// UnpackMajorityMargin is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xaa02a90f.
|
||||
//
|
||||
|
|
@ -184,11 +244,12 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackMemberId is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x39106821.
|
||||
// the contract method with ID 0x39106821. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function memberId(address ) returns(uint256)
|
||||
func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
|
||||
|
|
@ -199,6 +260,15 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMemberId is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x39106821. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function memberId(address ) returns(uint256)
|
||||
func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) {
|
||||
return dAO.abi.Pack("memberId", arg0)
|
||||
}
|
||||
|
||||
// UnpackMemberId is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x39106821.
|
||||
//
|
||||
|
|
@ -209,11 +279,12 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackMembers is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5daf08ca.
|
||||
// the contract method with ID 0x5daf08ca. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
|
||||
func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
|
||||
|
|
@ -224,6 +295,15 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMembers is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5daf08ca. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
|
||||
func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) {
|
||||
return dAO.abi.Pack("members", arg0)
|
||||
}
|
||||
|
||||
// MembersOutput serves as a container for the return parameters of contract
|
||||
// method Members.
|
||||
type MembersOutput struct {
|
||||
|
|
@ -247,12 +327,12 @@ func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) {
|
|||
outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool)
|
||||
outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string)
|
||||
outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackMinimumQuorum is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8160f0b5.
|
||||
// the contract method with ID 0x8160f0b5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function minimumQuorum() returns(uint256)
|
||||
func (dAO *DAO) PackMinimumQuorum() []byte {
|
||||
|
|
@ -263,6 +343,15 @@ func (dAO *DAO) PackMinimumQuorum() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMinimumQuorum is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8160f0b5. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function minimumQuorum() returns(uint256)
|
||||
func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) {
|
||||
return dAO.abi.Pack("minimumQuorum")
|
||||
}
|
||||
|
||||
// UnpackMinimumQuorum is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x8160f0b5.
|
||||
//
|
||||
|
|
@ -273,11 +362,12 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackNewProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb1050da5.
|
||||
// the contract method with ID 0xb1050da5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
|
||||
func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte {
|
||||
|
|
@ -288,6 +378,15 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNewProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb1050da5. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
|
||||
func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) {
|
||||
return dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode)
|
||||
}
|
||||
|
||||
// UnpackNewProposal is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xb1050da5.
|
||||
//
|
||||
|
|
@ -298,11 +397,12 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackNumProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x400e3949.
|
||||
// the contract method with ID 0x400e3949. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function numProposals() returns(uint256)
|
||||
func (dAO *DAO) PackNumProposals() []byte {
|
||||
|
|
@ -313,6 +413,15 @@ func (dAO *DAO) PackNumProposals() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNumProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x400e3949. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function numProposals() returns(uint256)
|
||||
func (dAO *DAO) TryPackNumProposals() ([]byte, error) {
|
||||
return dAO.abi.Pack("numProposals")
|
||||
}
|
||||
|
||||
// UnpackNumProposals is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x400e3949.
|
||||
//
|
||||
|
|
@ -323,11 +432,12 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackOwner is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8da5cb5b.
|
||||
// the contract method with ID 0x8da5cb5b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function owner() returns(address)
|
||||
func (dAO *DAO) PackOwner() []byte {
|
||||
|
|
@ -338,6 +448,15 @@ func (dAO *DAO) PackOwner() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackOwner is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8da5cb5b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function owner() returns(address)
|
||||
func (dAO *DAO) TryPackOwner() ([]byte, error) {
|
||||
return dAO.abi.Pack("owner")
|
||||
}
|
||||
|
||||
// UnpackOwner is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x8da5cb5b.
|
||||
//
|
||||
|
|
@ -348,11 +467,12 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) {
|
|||
return *new(common.Address), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x013cf08b.
|
||||
// the contract method with ID 0x013cf08b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
|
||||
func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
|
||||
|
|
@ -363,6 +483,15 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x013cf08b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
|
||||
func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) {
|
||||
return dAO.abi.Pack("proposals", arg0)
|
||||
}
|
||||
|
||||
// ProposalsOutput serves as a container for the return parameters of contract
|
||||
// method Proposals.
|
||||
type ProposalsOutput struct {
|
||||
|
|
@ -396,12 +525,12 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) {
|
|||
outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int)
|
||||
outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int)
|
||||
outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackTransferOwnership is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf2fde38b.
|
||||
// the contract method with ID 0xf2fde38b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
|
||||
|
|
@ -412,8 +541,18 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTransferOwnership is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf2fde38b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (dAO *DAO) TryPackTransferOwnership(newOwner common.Address) ([]byte, error) {
|
||||
return dAO.abi.Pack("transferOwnership", newOwner)
|
||||
}
|
||||
|
||||
// PackVote is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd3c0715b.
|
||||
// the contract method with ID 0xd3c0715b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
|
||||
func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte {
|
||||
|
|
@ -424,6 +563,15 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackVote is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd3c0715b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
|
||||
func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) {
|
||||
return dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText)
|
||||
}
|
||||
|
||||
// UnpackVote is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xd3c0715b.
|
||||
//
|
||||
|
|
@ -434,7 +582,7 @@ func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A
|
|||
}
|
||||
|
||||
// PackDeepUint64Array is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x98ed1856.
|
||||
// the contract method with ID 0x98ed1856. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDeepUint64Array is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x98ed1856. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) {
|
||||
return deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// UnpackDeepUint64Array is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x98ed1856.
|
||||
//
|
||||
|
|
@ -73,11 +83,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) (
|
|||
return *new(uint64), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8ed4573a.
|
||||
// the contract method with ID 0x8ed4573a. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5])
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte {
|
||||
|
|
@ -88,6 +99,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackRetrieveDeepArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8ed4573a. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5])
|
||||
func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) {
|
||||
return deeplyNestedArray.abi.Pack("retrieveDeepArray")
|
||||
}
|
||||
|
||||
// UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x8ed4573a.
|
||||
//
|
||||
|
|
@ -98,11 +118,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte)
|
|||
return *new([5][4][3]uint64), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x34424855.
|
||||
// the contract method with ID 0x34424855. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte {
|
||||
|
|
@ -112,3 +133,12 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]
|
|||
}
|
||||
return enc
|
||||
}
|
||||
|
||||
// TryPackStoreDeepUintArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x34424855. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
|
||||
func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) {
|
||||
return deeplyNestedArray.abi.Pack("storeDeepUintArray", arr)
|
||||
}
|
||||
|
|
|
|||
15
accounts/abi/abigen/testdata/v2/getter.go.txt
vendored
15
accounts/abi/abigen/testdata/v2/getter.go.txt
vendored
|
|
@ -52,7 +52,8 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi
|
|||
}
|
||||
|
||||
// PackGetter is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x993a04b7.
|
||||
// the contract method with ID 0x993a04b7. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function getter() returns(string, int256, bytes32)
|
||||
func (getter *Getter) PackGetter() []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (getter *Getter) PackGetter() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetter is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x993a04b7. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function getter() returns(string, int256, bytes32)
|
||||
func (getter *Getter) TryPackGetter() ([]byte, error) {
|
||||
return getter.abi.Pack("getter")
|
||||
}
|
||||
|
||||
// GetterOutput serves as a container for the return parameters of contract
|
||||
// method Getter.
|
||||
type GetterOutput struct {
|
||||
|
|
@ -84,6 +94,5 @@ func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) {
|
|||
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common
|
|||
}
|
||||
|
||||
// PackMyVar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x4ef1f0ad.
|
||||
// the contract method with ID 0x4ef1f0ad. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function MyVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMyVar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x4ef1f0ad. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function MyVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) {
|
||||
return identifierCollision.abi.Pack("MyVar")
|
||||
}
|
||||
|
||||
// UnpackMyVar is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x4ef1f0ad.
|
||||
//
|
||||
|
|
@ -73,11 +83,12 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackPubVar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01ad4d87.
|
||||
// the contract method with ID 0x01ad4d87. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function _myVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
|
||||
|
|
@ -88,6 +99,15 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackPubVar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01ad4d87. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function _myVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) {
|
||||
return identifierCollision.abi.Pack("_myVar")
|
||||
}
|
||||
|
||||
// UnpackPubVar is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x01ad4d87.
|
||||
//
|
||||
|
|
@ -98,5 +118,5 @@ func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big.
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
}
|
||||
|
||||
// PackAnonInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3e708e82.
|
||||
// the contract method with ID 0x3e708e82. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function anonInput(string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
|
||||
|
|
@ -62,8 +63,18 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAnonInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3e708e82. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function anonInput(string ) returns()
|
||||
func (inputChecker *InputChecker) TryPackAnonInput(arg0 string) ([]byte, error) {
|
||||
return inputChecker.abi.Pack("anonInput", arg0)
|
||||
}
|
||||
|
||||
// PackAnonInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x28160527.
|
||||
// the contract method with ID 0x28160527. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function anonInputs(string , string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte {
|
||||
|
|
@ -74,8 +85,18 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAnonInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x28160527. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function anonInputs(string , string ) returns()
|
||||
func (inputChecker *InputChecker) TryPackAnonInputs(arg0 string, arg1 string) ([]byte, error) {
|
||||
return inputChecker.abi.Pack("anonInputs", arg0, arg1)
|
||||
}
|
||||
|
||||
// PackMixedInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xc689ebdc.
|
||||
// the contract method with ID 0xc689ebdc. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function mixedInputs(string , string str) returns()
|
||||
func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte {
|
||||
|
|
@ -86,8 +107,18 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMixedInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xc689ebdc. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function mixedInputs(string , string str) returns()
|
||||
func (inputChecker *InputChecker) TryPackMixedInputs(arg0 string, str string) ([]byte, error) {
|
||||
return inputChecker.abi.Pack("mixedInputs", arg0, str)
|
||||
}
|
||||
|
||||
// PackNamedInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x0d402005.
|
||||
// the contract method with ID 0x0d402005. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function namedInput(string str) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
|
||||
|
|
@ -98,8 +129,18 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNamedInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x0d402005. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function namedInput(string str) returns()
|
||||
func (inputChecker *InputChecker) TryPackNamedInput(str string) ([]byte, error) {
|
||||
return inputChecker.abi.Pack("namedInput", str)
|
||||
}
|
||||
|
||||
// PackNamedInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x63c796ed.
|
||||
// the contract method with ID 0x63c796ed. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function namedInputs(string str1, string str2) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte {
|
||||
|
|
@ -110,8 +151,18 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNamedInputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x63c796ed. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function namedInputs(string str1, string str2) returns()
|
||||
func (inputChecker *InputChecker) TryPackNamedInputs(str1 string, str2 string) ([]byte, error) {
|
||||
return inputChecker.abi.Pack("namedInputs", str1, str2)
|
||||
}
|
||||
|
||||
// PackNoInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x53539029.
|
||||
// the contract method with ID 0x53539029. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function noInput() returns()
|
||||
func (inputChecker *InputChecker) PackNoInput() []byte {
|
||||
|
|
@ -121,3 +172,12 @@ func (inputChecker *InputChecker) PackNoInput() []byte {
|
|||
}
|
||||
return enc
|
||||
}
|
||||
|
||||
// TryPackNoInput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x53539029. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function noInput() returns()
|
||||
func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) {
|
||||
return inputChecker.abi.Pack("noInput")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ func (interactor *Interactor) PackConstructor(str string) []byte {
|
|||
}
|
||||
|
||||
// PackDeployString is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6874e809.
|
||||
// the contract method with ID 0x6874e809. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function deployString() returns(string)
|
||||
func (interactor *Interactor) PackDeployString() []byte {
|
||||
|
|
@ -75,6 +76,15 @@ func (interactor *Interactor) PackDeployString() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDeployString is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6874e809. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function deployString() returns(string)
|
||||
func (interactor *Interactor) TryPackDeployString() ([]byte, error) {
|
||||
return interactor.abi.Pack("deployString")
|
||||
}
|
||||
|
||||
// UnpackDeployString is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x6874e809.
|
||||
//
|
||||
|
|
@ -85,11 +95,12 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackTransact is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd736c513.
|
||||
// the contract method with ID 0xd736c513. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function transact(string str) returns()
|
||||
func (interactor *Interactor) PackTransact(str string) []byte {
|
||||
|
|
@ -100,8 +111,18 @@ func (interactor *Interactor) PackTransact(str string) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTransact is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd736c513. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function transact(string str) returns()
|
||||
func (interactor *Interactor) TryPackTransact(str string) ([]byte, error) {
|
||||
return interactor.abi.Pack("transact", str)
|
||||
}
|
||||
|
||||
// PackTransactString is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x0d86a0e1.
|
||||
// the contract method with ID 0x0d86a0e1. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function transactString() returns(string)
|
||||
func (interactor *Interactor) PackTransactString() []byte {
|
||||
|
|
@ -112,6 +133,15 @@ func (interactor *Interactor) PackTransactString() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTransactString is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x0d86a0e1. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function transactString() returns(string)
|
||||
func (interactor *Interactor) TryPackTransactString() ([]byte, error) {
|
||||
return interactor.abi.Pack("transactString")
|
||||
}
|
||||
|
||||
// UnpackTransactString is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x0d86a0e1.
|
||||
//
|
||||
|
|
@ -122,5 +152,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error)
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
}
|
||||
|
||||
// PackAddRequest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcce7b048.
|
||||
// the contract method with ID 0xcce7b048. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function addRequest((bytes,bytes) req) pure returns()
|
||||
func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
|
||||
|
|
@ -69,8 +70,18 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAddRequest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcce7b048. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function addRequest((bytes,bytes) req) pure returns()
|
||||
func (nameConflict *NameConflict) TryPackAddRequest(req Oraclerequest) ([]byte, error) {
|
||||
return nameConflict.abi.Pack("addRequest", req)
|
||||
}
|
||||
|
||||
// PackGetRequest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xc2bb515f.
|
||||
// the contract method with ID 0xc2bb515f. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function getRequest() pure returns((bytes,bytes))
|
||||
func (nameConflict *NameConflict) PackGetRequest() []byte {
|
||||
|
|
@ -81,6 +92,15 @@ func (nameConflict *NameConflict) PackGetRequest() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetRequest is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xc2bb515f. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function getRequest() pure returns((bytes,bytes))
|
||||
func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) {
|
||||
return nameConflict.abi.Pack("getRequest")
|
||||
}
|
||||
|
||||
// UnpackGetRequest is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xc2bb515f.
|
||||
//
|
||||
|
|
@ -91,7 +111,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest,
|
|||
return *new(Oraclerequest), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// NameConflictLog represents a log event raised by the NameConflict contract.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A
|
|||
}
|
||||
|
||||
// PackE1test is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xffa02795.
|
||||
// the contract method with ID 0xffa02795. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function _1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE1test() []byte {
|
||||
|
|
@ -63,8 +64,18 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackE1test is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xffa02795. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function _1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) TryPackE1test() ([]byte, error) {
|
||||
return numericMethodName.abi.Pack("_1test")
|
||||
}
|
||||
|
||||
// PackE1test0 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd02767c7.
|
||||
// the contract method with ID 0xd02767c7. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function __1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE1test0() []byte {
|
||||
|
|
@ -75,8 +86,18 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackE1test0 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd02767c7. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function __1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) TryPackE1test0() ([]byte, error) {
|
||||
return numericMethodName.abi.Pack("__1test")
|
||||
}
|
||||
|
||||
// PackE2test is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9d993132.
|
||||
// the contract method with ID 0x9d993132. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function __2test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE2test() []byte {
|
||||
|
|
@ -87,6 +108,15 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackE2test is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9d993132. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function __2test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) {
|
||||
return numericMethodName.abi.Pack("__2test")
|
||||
}
|
||||
|
||||
// NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract.
|
||||
type NumericMethodNameE1TestEvent struct {
|
||||
Param common.Address
|
||||
|
|
|
|||
100
accounts/abi/abigen/testdata/v2/outputchecker.go.txt
vendored
100
accounts/abi/abigen/testdata/v2/outputchecker.go.txt
vendored
|
|
@ -51,7 +51,8 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre
|
|||
}
|
||||
|
||||
// PackAnonOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x008bda05.
|
||||
// the contract method with ID 0x008bda05. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function anonOutput() returns(string)
|
||||
func (outputChecker *OutputChecker) PackAnonOutput() []byte {
|
||||
|
|
@ -62,6 +63,15 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAnonOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x008bda05. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function anonOutput() returns(string)
|
||||
func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("anonOutput")
|
||||
}
|
||||
|
||||
// UnpackAnonOutput is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x008bda05.
|
||||
//
|
||||
|
|
@ -72,11 +82,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackAnonOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3c401115.
|
||||
// the contract method with ID 0x3c401115. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function anonOutputs() returns(string, string)
|
||||
func (outputChecker *OutputChecker) PackAnonOutputs() []byte {
|
||||
|
|
@ -87,6 +98,15 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAnonOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3c401115. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function anonOutputs() returns(string, string)
|
||||
func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("anonOutputs")
|
||||
}
|
||||
|
||||
// AnonOutputsOutput serves as a container for the return parameters of contract
|
||||
// method AnonOutputs.
|
||||
type AnonOutputsOutput struct {
|
||||
|
|
@ -106,12 +126,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsO
|
|||
}
|
||||
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackCollidingOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xeccbc1ee.
|
||||
// the contract method with ID 0xeccbc1ee. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function collidingOutputs() returns(string str, string Str)
|
||||
func (outputChecker *OutputChecker) PackCollidingOutputs() []byte {
|
||||
|
|
@ -122,6 +142,15 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackCollidingOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xeccbc1ee. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function collidingOutputs() returns(string str, string Str)
|
||||
func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("collidingOutputs")
|
||||
}
|
||||
|
||||
// CollidingOutputsOutput serves as a container for the return parameters of contract
|
||||
// method CollidingOutputs.
|
||||
type CollidingOutputsOutput struct {
|
||||
|
|
@ -141,12 +170,12 @@ func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (Collidi
|
|||
}
|
||||
outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackMixedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x21b77b44.
|
||||
// the contract method with ID 0x21b77b44. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function mixedOutputs() returns(string, string str)
|
||||
func (outputChecker *OutputChecker) PackMixedOutputs() []byte {
|
||||
|
|
@ -157,6 +186,15 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackMixedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x21b77b44. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function mixedOutputs() returns(string, string str)
|
||||
func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("mixedOutputs")
|
||||
}
|
||||
|
||||
// MixedOutputsOutput serves as a container for the return parameters of contract
|
||||
// method MixedOutputs.
|
||||
type MixedOutputsOutput struct {
|
||||
|
|
@ -176,12 +214,12 @@ func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutput
|
|||
}
|
||||
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackNamedOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5e632bd5.
|
||||
// the contract method with ID 0x5e632bd5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function namedOutput() returns(string str)
|
||||
func (outputChecker *OutputChecker) PackNamedOutput() []byte {
|
||||
|
|
@ -192,6 +230,15 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNamedOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5e632bd5. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function namedOutput() returns(string str)
|
||||
func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("namedOutput")
|
||||
}
|
||||
|
||||
// UnpackNamedOutput is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x5e632bd5.
|
||||
//
|
||||
|
|
@ -202,11 +249,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackNamedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7970a189.
|
||||
// the contract method with ID 0x7970a189. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function namedOutputs() returns(string str1, string str2)
|
||||
func (outputChecker *OutputChecker) PackNamedOutputs() []byte {
|
||||
|
|
@ -217,6 +265,15 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackNamedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7970a189. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function namedOutputs() returns(string str1, string str2)
|
||||
func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("namedOutputs")
|
||||
}
|
||||
|
||||
// NamedOutputsOutput serves as a container for the return parameters of contract
|
||||
// method NamedOutputs.
|
||||
type NamedOutputsOutput struct {
|
||||
|
|
@ -236,12 +293,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutput
|
|||
}
|
||||
outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackNoOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x625f0306.
|
||||
// the contract method with ID 0x625f0306. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function noOutput() returns()
|
||||
func (outputChecker *OutputChecker) PackNoOutput() []byte {
|
||||
|
|
@ -251,3 +308,12 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte {
|
|||
}
|
||||
return enc
|
||||
}
|
||||
|
||||
// TryPackNoOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x625f0306. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function noOutput() returns()
|
||||
func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) {
|
||||
return outputChecker.abi.Pack("noOutput")
|
||||
}
|
||||
|
|
|
|||
24
accounts/abi/abigen/testdata/v2/overload.go.txt
vendored
24
accounts/abi/abigen/testdata/v2/overload.go.txt
vendored
|
|
@ -52,7 +52,8 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *
|
|||
}
|
||||
|
||||
// PackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x04bc52f8.
|
||||
// the contract method with ID 0x04bc52f8. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function foo(uint256 i, uint256 j) returns()
|
||||
func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
|
||||
|
|
@ -63,8 +64,18 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x04bc52f8. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function foo(uint256 i, uint256 j) returns()
|
||||
func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) {
|
||||
return overload.abi.Pack("foo", i, j)
|
||||
}
|
||||
|
||||
// PackFoo0 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2fbebd38.
|
||||
// the contract method with ID 0x2fbebd38. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function foo(uint256 i) returns()
|
||||
func (overload *Overload) PackFoo0(i *big.Int) []byte {
|
||||
|
|
@ -75,6 +86,15 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFoo0 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2fbebd38. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function foo(uint256 i) returns()
|
||||
func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) {
|
||||
return overload.abi.Pack("foo0", i)
|
||||
}
|
||||
|
||||
// OverloadBar represents a bar event raised by the Overload contract.
|
||||
type OverloadBar struct {
|
||||
I *big.Int
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres
|
|||
}
|
||||
|
||||
// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x527a119f.
|
||||
// the contract method with ID 0x527a119f. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
|
||||
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte {
|
||||
|
|
@ -62,3 +63,12 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int
|
|||
}
|
||||
return enc
|
||||
}
|
||||
|
||||
// TryPackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x527a119f. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
|
||||
func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) {
|
||||
return rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0)
|
||||
}
|
||||
|
|
|
|||
56
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
56
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
|
|
@ -52,7 +52,8 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi
|
|||
}
|
||||
|
||||
// PackEchoAddresses is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbe1127a3.
|
||||
// the contract method with ID 0xbe1127a3. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function echoAddresses(address[] input) returns(address[] output)
|
||||
func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEchoAddresses is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbe1127a3. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function echoAddresses(address[] input) returns(address[] output)
|
||||
func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) {
|
||||
return slicer.abi.Pack("echoAddresses", input)
|
||||
}
|
||||
|
||||
// UnpackEchoAddresses is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xbe1127a3.
|
||||
//
|
||||
|
|
@ -73,11 +83,12 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error)
|
|||
return *new([]common.Address), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackEchoBools is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf637e589.
|
||||
// the contract method with ID 0xf637e589. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function echoBools(bool[] input) returns(bool[] output)
|
||||
func (slicer *Slicer) PackEchoBools(input []bool) []byte {
|
||||
|
|
@ -88,6 +99,15 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEchoBools is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf637e589. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function echoBools(bool[] input) returns(bool[] output)
|
||||
func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) {
|
||||
return slicer.abi.Pack("echoBools", input)
|
||||
}
|
||||
|
||||
// UnpackEchoBools is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xf637e589.
|
||||
//
|
||||
|
|
@ -98,11 +118,12 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
|
|||
return *new([]bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackEchoFancyInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd88becc0.
|
||||
// the contract method with ID 0xd88becc0. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
|
||||
func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
|
||||
|
|
@ -113,6 +134,15 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEchoFancyInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd88becc0. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
|
||||
func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) {
|
||||
return slicer.abi.Pack("echoFancyInts", input)
|
||||
}
|
||||
|
||||
// UnpackEchoFancyInts is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xd88becc0.
|
||||
//
|
||||
|
|
@ -123,11 +153,12 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) {
|
|||
return *new([23]*big.Int), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackEchoInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe15a3db7.
|
||||
// the contract method with ID 0xe15a3db7. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function echoInts(int256[] input) returns(int256[] output)
|
||||
func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
|
||||
|
|
@ -138,6 +169,15 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEchoInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe15a3db7. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function echoInts(int256[] input) returns(int256[] output)
|
||||
func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) {
|
||||
return slicer.abi.Pack("echoInts", input)
|
||||
}
|
||||
|
||||
// UnpackEchoInts is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xe15a3db7.
|
||||
//
|
||||
|
|
@ -148,5 +188,5 @@ func (slicer *Slicer) UnpackEchoInts(data []byte) ([]*big.Int, error) {
|
|||
return *new([]*big.Int), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
29
accounts/abi/abigen/testdata/v2/structs.go.txt
vendored
29
accounts/abi/abigen/testdata/v2/structs.go.txt
vendored
|
|
@ -57,7 +57,8 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b
|
|||
}
|
||||
|
||||
// PackF is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x28811f59.
|
||||
// the contract method with ID 0x28811f59. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
|
||||
func (structs *Structs) PackF() []byte {
|
||||
|
|
@ -68,6 +69,15 @@ func (structs *Structs) PackF() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackF is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x28811f59. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
|
||||
func (structs *Structs) TryPackF() ([]byte, error) {
|
||||
return structs.abi.Pack("F")
|
||||
}
|
||||
|
||||
// FOutput serves as a container for the return parameters of contract
|
||||
// method F.
|
||||
type FOutput struct {
|
||||
|
|
@ -89,12 +99,12 @@ func (structs *Structs) UnpackF(data []byte) (FOutput, error) {
|
|||
outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
|
||||
outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int)
|
||||
outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackG is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fecb623.
|
||||
// the contract method with ID 0x6fecb623. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function G() view returns((bytes32)[] a)
|
||||
func (structs *Structs) PackG() []byte {
|
||||
|
|
@ -105,6 +115,15 @@ func (structs *Structs) PackG() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackG is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fecb623. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function G() view returns((bytes32)[] a)
|
||||
func (structs *Structs) TryPackG() ([]byte, error) {
|
||||
return structs.abi.Pack("G")
|
||||
}
|
||||
|
||||
// UnpackG is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x6fecb623.
|
||||
//
|
||||
|
|
@ -115,5 +134,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) {
|
|||
return *new([]Struct0), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
124
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
124
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
|
|
@ -64,7 +64,8 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de
|
|||
}
|
||||
|
||||
// PackAllowance is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdd62ed3e.
|
||||
// the contract method with ID 0xdd62ed3e. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function allowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
|
|
@ -75,6 +76,15 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAllowance is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdd62ed3e. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function allowance(address , address ) returns(uint256)
|
||||
func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) {
|
||||
return token.abi.Pack("allowance", arg0, arg1)
|
||||
}
|
||||
|
||||
// UnpackAllowance is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xdd62ed3e.
|
||||
//
|
||||
|
|
@ -85,11 +95,12 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackApproveAndCall is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcae9ca51.
|
||||
// the contract method with ID 0xcae9ca51. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
|
||||
func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte {
|
||||
|
|
@ -100,6 +111,15 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackApproveAndCall is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcae9ca51. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
|
||||
func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) {
|
||||
return token.abi.Pack("approveAndCall", spender, value, extraData)
|
||||
}
|
||||
|
||||
// UnpackApproveAndCall is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xcae9ca51.
|
||||
//
|
||||
|
|
@ -110,11 +130,12 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackBalanceOf is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x70a08231.
|
||||
// the contract method with ID 0x70a08231. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function balanceOf(address ) returns(uint256)
|
||||
func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
|
||||
|
|
@ -125,6 +146,15 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackBalanceOf is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x70a08231. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function balanceOf(address ) returns(uint256)
|
||||
func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) {
|
||||
return token.abi.Pack("balanceOf", arg0)
|
||||
}
|
||||
|
||||
// UnpackBalanceOf is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x70a08231.
|
||||
//
|
||||
|
|
@ -135,11 +165,12 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackDecimals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x313ce567.
|
||||
// the contract method with ID 0x313ce567. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function decimals() returns(uint8)
|
||||
func (token *Token) PackDecimals() []byte {
|
||||
|
|
@ -150,6 +181,15 @@ func (token *Token) PackDecimals() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDecimals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x313ce567. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function decimals() returns(uint8)
|
||||
func (token *Token) TryPackDecimals() ([]byte, error) {
|
||||
return token.abi.Pack("decimals")
|
||||
}
|
||||
|
||||
// UnpackDecimals is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x313ce567.
|
||||
//
|
||||
|
|
@ -160,11 +200,12 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) {
|
|||
return *new(uint8), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackName is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x06fdde03.
|
||||
// the contract method with ID 0x06fdde03. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function name() returns(string)
|
||||
func (token *Token) PackName() []byte {
|
||||
|
|
@ -175,6 +216,15 @@ func (token *Token) PackName() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackName is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x06fdde03. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function name() returns(string)
|
||||
func (token *Token) TryPackName() ([]byte, error) {
|
||||
return token.abi.Pack("name")
|
||||
}
|
||||
|
||||
// UnpackName is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x06fdde03.
|
||||
//
|
||||
|
|
@ -185,11 +235,12 @@ func (token *Token) UnpackName(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackSpentAllowance is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc3080f2.
|
||||
// the contract method with ID 0xdc3080f2. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function spentAllowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
|
|
@ -200,6 +251,15 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address)
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackSpentAllowance is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc3080f2. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function spentAllowance(address , address ) returns(uint256)
|
||||
func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) {
|
||||
return token.abi.Pack("spentAllowance", arg0, arg1)
|
||||
}
|
||||
|
||||
// UnpackSpentAllowance is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xdc3080f2.
|
||||
//
|
||||
|
|
@ -210,11 +270,12 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackSymbol is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x95d89b41.
|
||||
// the contract method with ID 0x95d89b41. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function symbol() returns(string)
|
||||
func (token *Token) PackSymbol() []byte {
|
||||
|
|
@ -225,6 +286,15 @@ func (token *Token) PackSymbol() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackSymbol is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x95d89b41. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function symbol() returns(string)
|
||||
func (token *Token) TryPackSymbol() ([]byte, error) {
|
||||
return token.abi.Pack("symbol")
|
||||
}
|
||||
|
||||
// UnpackSymbol is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x95d89b41.
|
||||
//
|
||||
|
|
@ -235,11 +305,12 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackTransfer is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa9059cbb.
|
||||
// the contract method with ID 0xa9059cbb. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function transfer(address _to, uint256 _value) returns()
|
||||
func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
|
||||
|
|
@ -250,8 +321,18 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTransfer is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa9059cbb. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function transfer(address _to, uint256 _value) returns()
|
||||
func (token *Token) TryPackTransfer(to common.Address, value *big.Int) ([]byte, error) {
|
||||
return token.abi.Pack("transfer", to, value)
|
||||
}
|
||||
|
||||
// PackTransferFrom is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x23b872dd.
|
||||
// the contract method with ID 0x23b872dd. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
|
||||
func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte {
|
||||
|
|
@ -262,6 +343,15 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTransferFrom is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x23b872dd. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
|
||||
func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) {
|
||||
return token.abi.Pack("transferFrom", from, to, value)
|
||||
}
|
||||
|
||||
// UnpackTransferFrom is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x23b872dd.
|
||||
//
|
||||
|
|
@ -272,7 +362,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// TokenTransfer represents a Transfer event raised by the Token contract.
|
||||
|
|
|
|||
39
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
39
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
|
|
@ -77,7 +77,8 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin
|
|||
}
|
||||
|
||||
// PackFunc1 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x443c79b4.
|
||||
// the contract method with ID 0x443c79b4. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
|
||||
func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
|
||||
|
|
@ -88,6 +89,15 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFunc1 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x443c79b4. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
|
||||
func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) {
|
||||
return tuple.abi.Pack("func1", a, b, c, d, e)
|
||||
}
|
||||
|
||||
// Func1Output serves as a container for the return parameters of contract
|
||||
// method Func1.
|
||||
type Func1Output struct {
|
||||
|
|
@ -113,12 +123,12 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) {
|
|||
outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT)
|
||||
outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS)
|
||||
outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackFunc2 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd0062cdd.
|
||||
// the contract method with ID 0xd0062cdd. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
|
||||
func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
|
||||
|
|
@ -129,8 +139,18 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFunc2 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd0062cdd. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
|
||||
func (tuple *Tuple) TryPackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) {
|
||||
return tuple.abi.Pack("func2", a, b, c, d, e)
|
||||
}
|
||||
|
||||
// PackFunc3 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe4d9a43b.
|
||||
// the contract method with ID 0xe4d9a43b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function func3((uint16,uint16)[] ) pure returns()
|
||||
func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
|
||||
|
|
@ -141,6 +161,15 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFunc3 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe4d9a43b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function func3((uint16,uint16)[] ) pure returns()
|
||||
func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) {
|
||||
return tuple.abi.Pack("func3", arg0)
|
||||
}
|
||||
|
||||
// TupleTupleEvent represents a TupleEvent event raised by the Tuple contract.
|
||||
type TupleTupleEvent struct {
|
||||
A TupleS
|
||||
|
|
|
|||
15
accounts/abi/abigen/testdata/v2/tupler.go.txt
vendored
15
accounts/abi/abigen/testdata/v2/tupler.go.txt
vendored
|
|
@ -52,7 +52,8 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi
|
|||
}
|
||||
|
||||
// PackTuple is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3175aae2.
|
||||
// the contract method with ID 0x3175aae2. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function tuple() returns(string a, int256 b, bytes32 c)
|
||||
func (tupler *Tupler) PackTuple() []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (tupler *Tupler) PackTuple() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackTuple is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3175aae2. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function tuple() returns(string a, int256 b, bytes32 c)
|
||||
func (tupler *Tupler) TryPackTuple() ([]byte, error) {
|
||||
return tupler.abi.Pack("tuple")
|
||||
}
|
||||
|
||||
// TupleOutput serves as a container for the return parameters of contract
|
||||
// method Tuple.
|
||||
type TupleOutput struct {
|
||||
|
|
@ -84,6 +94,5 @@ func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) {
|
|||
outstruct.A = *abi.ConvertType(out[0], new(string)).(*string)
|
||||
outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
|
|
|||
119
accounts/abi/abigen/testdata/v2/underscorer.go.txt
vendored
119
accounts/abi/abigen/testdata/v2/underscorer.go.txt
vendored
|
|
@ -52,7 +52,8 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address
|
|||
}
|
||||
|
||||
// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb564b34d.
|
||||
// the contract method with ID 0xb564b34d. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __)
|
||||
func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb564b34d. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __)
|
||||
func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) {
|
||||
return underscorer.abi.Pack("AllPurelyUnderscoredOutput")
|
||||
}
|
||||
|
||||
// AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract
|
||||
// method AllPurelyUnderscoredOutput.
|
||||
type AllPurelyUnderscoredOutputOutput struct {
|
||||
|
|
@ -82,12 +92,12 @@ func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (A
|
|||
}
|
||||
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe409ca45.
|
||||
// the contract method with ID 0xe409ca45. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res)
|
||||
func (underscorer *Underscorer) PackLowerLowerCollision() []byte {
|
||||
|
|
@ -98,6 +108,15 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackLowerLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe409ca45. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res)
|
||||
func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) {
|
||||
return underscorer.abi.Pack("LowerLowerCollision")
|
||||
}
|
||||
|
||||
// LowerLowerCollisionOutput serves as a container for the return parameters of contract
|
||||
// method LowerLowerCollision.
|
||||
type LowerLowerCollisionOutput struct {
|
||||
|
|
@ -117,12 +136,12 @@ func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLow
|
|||
}
|
||||
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x03a59213.
|
||||
// the contract method with ID 0x03a59213. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res)
|
||||
func (underscorer *Underscorer) PackLowerUpperCollision() []byte {
|
||||
|
|
@ -133,6 +152,15 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackLowerUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x03a59213. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res)
|
||||
func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) {
|
||||
return underscorer.abi.Pack("LowerUpperCollision")
|
||||
}
|
||||
|
||||
// LowerUpperCollisionOutput serves as a container for the return parameters of contract
|
||||
// method LowerUpperCollision.
|
||||
type LowerUpperCollisionOutput struct {
|
||||
|
|
@ -152,12 +180,12 @@ func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpp
|
|||
}
|
||||
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9df48485.
|
||||
// the contract method with ID 0x9df48485. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res)
|
||||
func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte {
|
||||
|
|
@ -168,6 +196,15 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9df48485. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res)
|
||||
func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) {
|
||||
return underscorer.abi.Pack("PurelyUnderscoredOutput")
|
||||
}
|
||||
|
||||
// PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract
|
||||
// method PurelyUnderscoredOutput.
|
||||
type PurelyUnderscoredOutputOutput struct {
|
||||
|
|
@ -187,12 +224,12 @@ func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (Pure
|
|||
}
|
||||
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x67e6633d.
|
||||
// the contract method with ID 0x67e6633d. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string)
|
||||
func (underscorer *Underscorer) PackUnderscoredOutput() []byte {
|
||||
|
|
@ -203,6 +240,15 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x67e6633d. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string)
|
||||
func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) {
|
||||
return underscorer.abi.Pack("UnderscoredOutput")
|
||||
}
|
||||
|
||||
// UnderscoredOutputOutput serves as a container for the return parameters of contract
|
||||
// method UnderscoredOutput.
|
||||
type UnderscoredOutputOutput struct {
|
||||
|
|
@ -222,12 +268,12 @@ func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (Underscore
|
|||
}
|
||||
outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.String = *abi.ConvertType(out[1], new(string)).(*string)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaf7486ab.
|
||||
// the contract method with ID 0xaf7486ab. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res)
|
||||
func (underscorer *Underscorer) PackUpperLowerCollision() []byte {
|
||||
|
|
@ -238,6 +284,15 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackUpperLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaf7486ab. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res)
|
||||
func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) {
|
||||
return underscorer.abi.Pack("UpperLowerCollision")
|
||||
}
|
||||
|
||||
// UpperLowerCollisionOutput serves as a container for the return parameters of contract
|
||||
// method UpperLowerCollision.
|
||||
type UpperLowerCollisionOutput struct {
|
||||
|
|
@ -257,12 +312,12 @@ func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLow
|
|||
}
|
||||
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe02ab24d.
|
||||
// the contract method with ID 0xe02ab24d. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res)
|
||||
func (underscorer *Underscorer) PackUpperUpperCollision() []byte {
|
||||
|
|
@ -273,6 +328,15 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackUpperUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe02ab24d. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res)
|
||||
func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) {
|
||||
return underscorer.abi.Pack("UpperUpperCollision")
|
||||
}
|
||||
|
||||
// UpperUpperCollisionOutput serves as a container for the return parameters of contract
|
||||
// method UpperUpperCollision.
|
||||
type UpperUpperCollisionOutput struct {
|
||||
|
|
@ -292,12 +356,12 @@ func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpp
|
|||
}
|
||||
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x46546dbe.
|
||||
// the contract method with ID 0x46546dbe. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function _under_scored_func() view returns(int256 _int)
|
||||
func (underscorer *Underscorer) PackUnderScoredFunc() []byte {
|
||||
|
|
@ -308,6 +372,15 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackUnderScoredFunc is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x46546dbe. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function _under_scored_func() view returns(int256 _int)
|
||||
func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) {
|
||||
return underscorer.abi.Pack("_under_scored_func")
|
||||
}
|
||||
|
||||
// UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x46546dbe.
|
||||
//
|
||||
|
|
@ -318,5 +391,5 @@ func (underscorer *Underscorer) UnpackUnderScoredFunc(data []byte) (*big.Int, er
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackGet is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9507d39a.
|
||||
// the contract method with ID 0x9507d39a. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function get(uint256 k) returns(uint256)
|
||||
func (dB *DB) PackGet(k *big.Int) []byte {
|
||||
|
|
@ -70,6 +71,15 @@ func (dB *DB) PackGet(k *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGet is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9507d39a. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function get(uint256 k) returns(uint256)
|
||||
func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) {
|
||||
return dB.abi.Pack("get", k)
|
||||
}
|
||||
|
||||
// UnpackGet is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x9507d39a.
|
||||
//
|
||||
|
|
@ -80,11 +90,12 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe369ba3b.
|
||||
// the contract method with ID 0xe369ba3b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
|
||||
func (dB *DB) PackGetNamedStatParams() []byte {
|
||||
|
|
@ -95,6 +106,15 @@ func (dB *DB) PackGetNamedStatParams() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetNamedStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe369ba3b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
|
||||
func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) {
|
||||
return dB.abi.Pack("getNamedStatParams")
|
||||
}
|
||||
|
||||
// GetNamedStatParamsOutput serves as a container for the return parameters of contract
|
||||
// method GetNamedStatParams.
|
||||
type GetNamedStatParamsOutput struct {
|
||||
|
|
@ -116,12 +136,12 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, e
|
|||
outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackGetStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fcb9c70.
|
||||
// the contract method with ID 0x6fcb9c70. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function getStatParams() view returns(uint256, uint256, uint256)
|
||||
func (dB *DB) PackGetStatParams() []byte {
|
||||
|
|
@ -132,6 +152,15 @@ func (dB *DB) PackGetStatParams() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fcb9c70. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function getStatParams() view returns(uint256, uint256, uint256)
|
||||
func (dB *DB) TryPackGetStatParams() ([]byte, error) {
|
||||
return dB.abi.Pack("getStatParams")
|
||||
}
|
||||
|
||||
// GetStatParamsOutput serves as a container for the return parameters of contract
|
||||
// method GetStatParams.
|
||||
type GetStatParamsOutput struct {
|
||||
|
|
@ -153,12 +182,12 @@ func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) {
|
|||
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
|
||||
outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
|
||||
return *outstruct, err
|
||||
|
||||
return *outstruct, nil
|
||||
}
|
||||
|
||||
// PackGetStatsStruct is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xee8161e0.
|
||||
// the contract method with ID 0xee8161e0. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
|
||||
func (dB *DB) PackGetStatsStruct() []byte {
|
||||
|
|
@ -169,6 +198,15 @@ func (dB *DB) PackGetStatsStruct() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetStatsStruct is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xee8161e0. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
|
||||
func (dB *DB) TryPackGetStatsStruct() ([]byte, error) {
|
||||
return dB.abi.Pack("getStatsStruct")
|
||||
}
|
||||
|
||||
// UnpackGetStatsStruct is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xee8161e0.
|
||||
//
|
||||
|
|
@ -179,11 +217,12 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
|
|||
return *new(DBStats), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// PackInsert is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x1d834a1b.
|
||||
// the contract method with ID 0x1d834a1b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function insert(uint256 k, uint256 v) returns(uint256)
|
||||
func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
|
||||
|
|
@ -194,6 +233,15 @@ func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackInsert is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x1d834a1b. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function insert(uint256 k, uint256 v) returns(uint256)
|
||||
func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) {
|
||||
return dB.abi.Pack("insert", k, v)
|
||||
}
|
||||
|
||||
// UnpackInsert is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x1d834a1b.
|
||||
//
|
||||
|
|
@ -204,7 +252,7 @@ func (dB *DB) UnpackInsert(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// DBInsert represents a Insert event raised by the DB contract.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo
|
|||
}
|
||||
|
||||
// PackEmitMulti is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcb493749.
|
||||
// the contract method with ID 0xcb493749. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function EmitMulti() returns()
|
||||
func (c *C) PackEmitMulti() []byte {
|
||||
|
|
@ -63,8 +64,18 @@ func (c *C) PackEmitMulti() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEmitMulti is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcb493749. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function EmitMulti() returns()
|
||||
func (c *C) TryPackEmitMulti() ([]byte, error) {
|
||||
return c.abi.Pack("EmitMulti")
|
||||
}
|
||||
|
||||
// PackEmitOne is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe8e49a71.
|
||||
// the contract method with ID 0xe8e49a71. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function EmitOne() returns()
|
||||
func (c *C) PackEmitOne() []byte {
|
||||
|
|
@ -75,6 +86,15 @@ func (c *C) PackEmitOne() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackEmitOne is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe8e49a71. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function EmitOne() returns()
|
||||
func (c *C) TryPackEmitOne() ([]byte, error) {
|
||||
return c.abi.Pack("EmitOne")
|
||||
}
|
||||
|
||||
// CBasic1 represents a basic1 event raised by the C contract.
|
||||
type CBasic1 struct {
|
||||
Id *big.Int
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c1 *C1) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -79,6 +80,15 @@ func (c1 *C1) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c1 *C1) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return c1.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -89,7 +99,7 @@ func (c1 *C1) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// C2MetaData contains all meta data concerning the C2 contract.
|
||||
|
|
@ -136,7 +146,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c2 *C2) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -147,6 +158,15 @@ func (c2 *C2) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c2 *C2) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return c2.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -157,7 +177,7 @@ func (c2 *C2) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L1MetaData contains all meta data concerning the L1 contract.
|
||||
|
|
@ -188,7 +208,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l1 *L1) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -199,6 +220,15 @@ func (l1 *L1) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l1 *L1) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l1.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -209,7 +239,7 @@ func (l1 *L1) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L2MetaData contains all meta data concerning the L2 contract.
|
||||
|
|
@ -243,7 +273,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2 *L2) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -254,6 +285,15 @@ func (l2 *L2) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2 *L2) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l2.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -264,7 +304,7 @@ func (l2 *L2) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L2bMetaData contains all meta data concerning the L2b contract.
|
||||
|
|
@ -298,7 +338,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2b *L2b) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -309,6 +350,15 @@ func (l2b *L2b) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2b *L2b) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l2b.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -319,7 +369,7 @@ func (l2b *L2b) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L3MetaData contains all meta data concerning the L3 contract.
|
||||
|
|
@ -350,7 +400,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l3 *L3) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -361,6 +412,15 @@ func (l3 *L3) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l3 *L3) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l3.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -371,7 +431,7 @@ func (l3 *L3) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L4MetaData contains all meta data concerning the L4 contract.
|
||||
|
|
@ -406,7 +466,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4 *L4) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -417,6 +478,15 @@ func (l4 *L4) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4 *L4) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l4.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -427,7 +497,7 @@ func (l4 *L4) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
||||
// L4bMetaData contains all meta data concerning the L4b contract.
|
||||
|
|
@ -461,7 +531,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
|
|||
}
|
||||
|
||||
// PackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272.
|
||||
// the contract method with ID 0x2ad11272. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4b *L4b) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -472,6 +543,15 @@ func (l4b *L4b) PackDo(val *big.Int) []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackDo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x2ad11272. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4b *L4b) TryPackDo(val *big.Int) ([]byte, error) {
|
||||
return l4b.abi.Pack("Do", val)
|
||||
}
|
||||
|
||||
// UnpackDo is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x2ad11272.
|
||||
//
|
||||
|
|
@ -482,5 +562,5 @@ func (l4b *L4b) UnpackDo(data []byte) (*big.Int, error) {
|
|||
return new(big.Int), err
|
||||
}
|
||||
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo
|
|||
}
|
||||
|
||||
// PackBar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb0a378b0.
|
||||
// the contract method with ID 0xb0a378b0. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Bar() pure returns()
|
||||
func (c *C) PackBar() []byte {
|
||||
|
|
@ -63,8 +64,18 @@ func (c *C) PackBar() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackBar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb0a378b0. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Bar() pure returns()
|
||||
func (c *C) TryPackBar() ([]byte, error) {
|
||||
return c.abi.Pack("Bar")
|
||||
}
|
||||
|
||||
// PackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbfb4ebcf.
|
||||
// the contract method with ID 0xbfb4ebcf. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c *C) PackFoo() []byte {
|
||||
|
|
@ -75,6 +86,15 @@ func (c *C) PackFoo() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbfb4ebcf. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c *C) TryPackFoo() ([]byte, error) {
|
||||
return c.abi.Pack("Foo")
|
||||
}
|
||||
|
||||
// UnpackError attempts to decode the provided error data using user-defined
|
||||
// error definitions.
|
||||
func (c *C) UnpackError(raw []byte) (any, error) {
|
||||
|
|
@ -169,7 +189,8 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
|
|||
}
|
||||
|
||||
// PackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbfb4ebcf.
|
||||
// the contract method with ID 0xbfb4ebcf. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c2 *C2) PackFoo() []byte {
|
||||
|
|
@ -180,6 +201,15 @@ func (c2 *C2) PackFoo() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackFoo is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbfb4ebcf. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c2 *C2) TryPackFoo() ([]byte, error) {
|
||||
return c2.abi.Pack("Foo")
|
||||
}
|
||||
|
||||
// UnpackError attempts to decode the provided error data using user-defined
|
||||
// error definitions.
|
||||
func (c2 *C2) UnpackError(raw []byte) (any, error) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address)
|
|||
}
|
||||
|
||||
// PackGetNums is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbd6d1007.
|
||||
// the contract method with ID 0xbd6d1007. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
//
|
||||
// Solidity: function GetNums() pure returns(uint256[5])
|
||||
func (myContract *MyContract) PackGetNums() []byte {
|
||||
|
|
@ -63,6 +64,15 @@ func (myContract *MyContract) PackGetNums() []byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
// TryPackGetNums is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xbd6d1007. This method will return an error
|
||||
// if any inputs are invalid/nil.
|
||||
//
|
||||
// Solidity: function GetNums() pure returns(uint256[5])
|
||||
func (myContract *MyContract) TryPackGetNums() ([]byte, error) {
|
||||
return myContract.abi.Pack("GetNums")
|
||||
}
|
||||
|
||||
// UnpackGetNums is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0xbd6d1007.
|
||||
//
|
||||
|
|
@ -73,5 +83,5 @@ func (myContract *MyContract) UnpackGetNums(data []byte) ([5]*big.Int, error) {
|
|||
return *new([5]*big.Int), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([5]*big.Int)).(*[5]*big.Int)
|
||||
return out0, err
|
||||
return out0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package bind
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
|
|
@ -241,3 +242,27 @@ func DefaultDeployer(opts *TransactOpts, backend ContractBackend) DeployFn {
|
|||
return addr, tx, nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeployerWithNonceAssignment is basically identical to DefaultDeployer,
|
||||
// but it additionally tracks the nonce to enable automatic assignment.
|
||||
//
|
||||
// This is especially useful when deploying multiple contracts
|
||||
// from the same address — whether they are independent contracts
|
||||
// or part of a dependency chain that must be deployed in order.
|
||||
func DeployerWithNonceAssignment(opts *TransactOpts, backend ContractBackend) DeployFn {
|
||||
var pendingNonce int64
|
||||
if opts.Nonce != nil {
|
||||
pendingNonce = opts.Nonce.Int64()
|
||||
}
|
||||
return func(input []byte, deployer []byte) (common.Address, *types.Transaction, error) {
|
||||
if pendingNonce != 0 {
|
||||
opts.Nonce = big.NewInt(pendingNonce)
|
||||
}
|
||||
addr, tx, err := DeployContract(opts, deployer, backend, input)
|
||||
if err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
pendingNonce = int64(tx.Nonce() + 1)
|
||||
return addr, tx, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@ func makeTestDeployer(backend simulated.Client) func(input, deployer []byte) (co
|
|||
return bind.DefaultDeployer(bind.NewKeyedTransactor(testKey, chainId), backend)
|
||||
}
|
||||
|
||||
// makeTestDeployerWithNonceAssignment is similar to makeTestDeployer,
|
||||
// but it returns a deployer that automatically tracks nonce,
|
||||
// enabling the deployment of multiple contracts from the same account.
|
||||
func makeTestDeployerWithNonceAssignment(backend simulated.Client) func(input, deployer []byte) (common.Address, *types.Transaction, error) {
|
||||
chainId, _ := backend.ChainID(context.Background())
|
||||
return bind.DeployerWithNonceAssignment(bind.NewKeyedTransactor(testKey, chainId), backend)
|
||||
}
|
||||
|
||||
// test that deploying a contract with library dependencies works,
|
||||
// verifying by calling method on the deployed contract.
|
||||
func TestDeploymentLibraries(t *testing.T) {
|
||||
|
|
@ -80,7 +88,7 @@ func TestDeploymentLibraries(t *testing.T) {
|
|||
Contracts: []*bind.MetaData{&nested_libraries.C1MetaData},
|
||||
Inputs: map[string][]byte{nested_libraries.C1MetaData.ID: constructorInput},
|
||||
}
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend.Client))
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend.Client))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %+v\n", err)
|
||||
}
|
||||
|
|
@ -122,7 +130,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
|
|||
deploymentParams := &bind.DeploymentParams{
|
||||
Contracts: nested_libraries.C1MetaData.Deps,
|
||||
}
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend))
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %+v\n", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
// Package keystore implements encrypted storage of secp256k1 private keys.
|
||||
//
|
||||
// Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification.
|
||||
// See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.
|
||||
// See https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/ for more information.
|
||||
package keystore
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
This key store behaves as KeyStorePlain with the difference that
|
||||
the private key is encrypted and on disk uses another JSON encoding.
|
||||
|
||||
The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition
|
||||
The crypto is documented at https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -34,21 +34,13 @@ func TestBlobs(t *testing.T) {
|
|||
header := types.Header{}
|
||||
block := types.NewBlock(&header, &types.Body{}, nil, nil)
|
||||
|
||||
sidecarWithoutCellProofs := &types.BlobTxSidecar{
|
||||
Blobs: []kzg4844.Blob{*emptyBlob},
|
||||
Commitments: []kzg4844.Commitment{emptyBlobCommit},
|
||||
Proofs: []kzg4844.Proof{emptyBlobProof},
|
||||
}
|
||||
sidecarWithoutCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, []kzg4844.Proof{emptyBlobProof})
|
||||
env := BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithoutCellProofs}, nil)
|
||||
if len(env.BlobsBundle.Proofs) != 1 {
|
||||
t.Fatalf("Expect 1 proof in blobs bundle, got %v", len(env.BlobsBundle.Proofs))
|
||||
}
|
||||
|
||||
sidecarWithCellProofs := &types.BlobTxSidecar{
|
||||
Blobs: []kzg4844.Blob{*emptyBlob},
|
||||
Commitments: []kzg4844.Commitment{emptyBlobCommit},
|
||||
Proofs: emptyCellProof,
|
||||
}
|
||||
sidecarWithCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, emptyCellProof)
|
||||
env = BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithCellProofs}, nil)
|
||||
if len(env.BlobsBundle.Proofs) != 128 {
|
||||
t.Fatalf("Expect 128 proofs in blobs bundle, got %v", len(env.BlobsBundle.Proofs))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0xd60e5310c5d52ced44cfb13be4e9f22a1e6a6dc56964c3cccd429182d26d72d0
|
||||
0x4bae4b97deda095724560012cab1f80a5221ce0a37a4b5236d8ab63f595f29d9
|
||||
1
beacon/params/checkpoint_hoodi.hex
Normal file
1
beacon/params/checkpoint_hoodi.hex
Normal file
|
|
@ -0,0 +1 @@
|
|||
0x1bbf958008172591b6cbdb3d8d52e26998258e83d4bdb9eec10969d84519a6bd
|
||||
|
|
@ -1 +1 @@
|
|||
0x02f0bb348b0d45f95a9b7e2bb5705768ad06548876cee03d880a2c9dabb1ff88
|
||||
0x2fe39a39b6f7cbd549e0f74d259de6db486005a65bd3bd92840dd6ce21d6f4c8
|
||||
|
|
@ -1 +1 @@
|
|||
0xa0dad451a230c01be6f2492980ec5bb412d8cf33351a75e8b172b5b84a5fd03a
|
||||
0x86686b2b366e24134e0e3969a9c5f3759f92e5d2b04785b42e22cc7d468c2107
|
||||
|
|
@ -31,6 +31,9 @@ var checkpointSepolia string
|
|||
//go:embed checkpoint_holesky.hex
|
||||
var checkpointHolesky string
|
||||
|
||||
//go:embed checkpoint_hoodi.hex
|
||||
var checkpointHoodi string
|
||||
|
||||
var (
|
||||
MainnetLightConfig = (&ChainConfig{
|
||||
GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"),
|
||||
|
|
@ -71,7 +74,7 @@ var (
|
|||
HoodiLightConfig = (&ChainConfig{
|
||||
GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"),
|
||||
GenesisTime: 1742212800,
|
||||
Checkpoint: common.HexToHash(""),
|
||||
Checkpoint: common.HexToHash(checkpointHoodi),
|
||||
}).
|
||||
AddFork("GENESIS", 0, common.FromHex("0x10000910")).
|
||||
AddFork("ALTAIR", 0, common.FromHex("0x20000910")).
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# This file contains sha256 checksums of optional build dependencies.
|
||||
|
||||
# version:spec-tests v4.5.0
|
||||
# version:spec-tests fusaka-devnet-3%40v1.0.0
|
||||
# https://github.com/ethereum/execution-spec-tests/releases
|
||||
# https://github.com/ethereum/execution-spec-tests/releases/download/v4.5.0/
|
||||
58afb92a0075a2cb7c4dec1281f7cb88b21b02afbedad096b580f3f8cc14c54c fixtures_develop.tar.gz
|
||||
# https://github.com/ethereum/execution-spec-tests/releases/download/fusaka-devnet-3%40v1.0.0
|
||||
576261e1280e5300c458aa9b05eccb2fec5ff80a0005940dc52fa03fdd907249 fixtures_fusaka-devnet-3.tar.gz
|
||||
|
||||
# version:golang 1.24.4
|
||||
# https://go.dev/dl/
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ func doTest(cmdline []string) {
|
|||
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
|
||||
func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
|
||||
ext := ".tar.gz"
|
||||
base := "fixtures_develop"
|
||||
base := "fixtures_fusaka-devnet-3"
|
||||
archivePath := filepath.Join(cachedir, base+ext)
|
||||
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ The API-method `account_signGnosisSafeTx` was added. This method takes two param
|
|||
```
|
||||
|
||||
Not all fields are required, though. This method is really just a UX helper, which massages the
|
||||
input to conform to the `EIP-712` [specification](https://docs.gnosis.io/safe/docs/contracts_tx_execution/#transaction-hash)
|
||||
input to conform to the `EIP-712` [specification](https://docs.safe.global/core-api/transaction-service-reference/gnosis)
|
||||
for the Gnosis Safe, and making the output be directly importable to by a relay service.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func (c *Conn) Write(proto Proto, code uint64, msg any) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var errDisc error = fmt.Errorf("disconnect")
|
||||
var errDisc error = errors.New("disconnect")
|
||||
|
||||
// ReadEth reads an Eth sub-protocol wire message.
|
||||
func (c *Conn) ReadEth() (any, error) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package ethtest
|
|||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
|
@ -879,11 +880,7 @@ func makeSidecar(data ...byte) *types.BlobTxSidecar {
|
|||
commitments = append(commitments, c)
|
||||
proofs = append(proofs, p)
|
||||
}
|
||||
return &types.BlobTxSidecar{
|
||||
Blobs: blobs,
|
||||
Commitments: commitments,
|
||||
Proofs: proofs,
|
||||
}
|
||||
return types.NewBlobTxSidecar(types.BlobSidecarVersion0, blobs, commitments, proofs)
|
||||
}
|
||||
|
||||
func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Transactions) {
|
||||
|
|
@ -988,14 +985,10 @@ func (s *Suite) TestBlobViolations(t *utesting.T) {
|
|||
// data has been modified to produce a different commitment hash.
|
||||
func mangleSidecar(tx *types.Transaction) *types.Transaction {
|
||||
sidecar := tx.BlobTxSidecar()
|
||||
copy := types.BlobTxSidecar{
|
||||
Blobs: append([]kzg4844.Blob{}, sidecar.Blobs...),
|
||||
Commitments: append([]kzg4844.Commitment{}, sidecar.Commitments...),
|
||||
Proofs: append([]kzg4844.Proof{}, sidecar.Proofs...),
|
||||
}
|
||||
cpy := sidecar.Copy()
|
||||
// zero the first commitment to alter the sidecar hash
|
||||
copy.Commitments[0] = kzg4844.Commitment{}
|
||||
return tx.WithBlobTxSidecar(©)
|
||||
cpy.Commitments[0] = kzg4844.Commitment{}
|
||||
return tx.WithBlobTxSidecar(cpy)
|
||||
}
|
||||
|
||||
func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T) {
|
||||
|
|
@ -1100,7 +1093,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
|
|||
return
|
||||
}
|
||||
if !readUntilDisconnect(conn) {
|
||||
errc <- fmt.Errorf("expected bad peer to be disconnected")
|
||||
errc <- errors.New("expected bad peer to be disconnected")
|
||||
return
|
||||
}
|
||||
stage3.Done()
|
||||
|
|
@ -1147,7 +1140,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
|
|||
}
|
||||
|
||||
if req.GetPooledTransactionsRequest[0] != tx.Hash() {
|
||||
errc <- fmt.Errorf("requested unknown tx hash")
|
||||
errc <- errors.New("requested unknown tx hash")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -1157,7 +1150,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
|
|||
return
|
||||
}
|
||||
if readUntilDisconnect(conn) {
|
||||
errc <- fmt.Errorf("unexpected disconnect")
|
||||
errc <- errors.New("unexpected disconnect")
|
||||
return
|
||||
}
|
||||
close(errc)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/internal/utesting"
|
||||
"github.com/ethereum/go-ethereum/p2p/discover/v4wire"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -501,6 +502,36 @@ func FindnodeAmplificationWrongIP(t *utesting.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func ENRRequest(t *utesting.T) {
|
||||
t.Log(`This test sends an ENRRequest packet and expects a response containing a valid ENR.`)
|
||||
|
||||
te := newTestEnv(Remote, Listen1, Listen2)
|
||||
defer te.close()
|
||||
bond(t, te)
|
||||
|
||||
req := &v4wire.ENRRequest{Expiration: futureExpiration()}
|
||||
hash := te.send(te.l1, req)
|
||||
|
||||
response, _, err := te.read(te.l1)
|
||||
if err != nil {
|
||||
t.Fatal("read error:", err)
|
||||
}
|
||||
enrResp, ok := response.(*v4wire.ENRResponse)
|
||||
if !ok {
|
||||
t.Fatalf("expected ENRResponse packet, got %T", response)
|
||||
}
|
||||
if !bytes.Equal(enrResp.ReplyTok, hash) {
|
||||
t.Errorf("wrong hash in response packet: got %x, want %x", enrResp.ReplyTok, hash)
|
||||
}
|
||||
node, err := enode.New(enode.ValidSchemes, &enrResp.Record)
|
||||
if err != nil {
|
||||
t.Errorf("invalid record in response: %v", err)
|
||||
}
|
||||
if node.ID() != te.remote.ID() {
|
||||
t.Errorf("wrong node ID in response: got %v, want %v", node.ID(), te.remote.ID())
|
||||
}
|
||||
}
|
||||
|
||||
var AllTests = []utesting.Test{
|
||||
{Name: "Ping/Basic", Fn: BasicPing},
|
||||
{Name: "Ping/WrongTo", Fn: PingWrongTo},
|
||||
|
|
@ -510,6 +541,7 @@ var AllTests = []utesting.Test{
|
|||
{Name: "Ping/PastExpiration", Fn: PingPastExpiration},
|
||||
{Name: "Ping/WrongPacketType", Fn: WrongPacketType},
|
||||
{Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom},
|
||||
{Name: "ENRRequest", Fn: ENRRequest},
|
||||
{Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof},
|
||||
{Name: "Findnode/BasicFindnode", Fn: BasicFindnode},
|
||||
{Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors},
|
||||
|
|
|
|||
|
|
@ -183,6 +183,9 @@ func Transaction(ctx *cli.Context) error {
|
|||
if chainConfig.IsShanghai(new(big.Int), 0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
|
||||
r.Error = errors.New("max initcode size exceeded")
|
||||
}
|
||||
if chainConfig.IsOsaka(new(big.Int), 0) && tx.Gas() > params.MaxTxGas {
|
||||
r.Error = errors.New("gas limit exceeds maximum")
|
||||
}
|
||||
results = append(results, r)
|
||||
}
|
||||
out, err := json.MarshalIndent(results, "", " ")
|
||||
|
|
|
|||
|
|
@ -576,8 +576,8 @@ func parseDumpConfig(ctx *cli.Context, db ethdb.Database) (*state.DumpConfig, co
|
|||
arg := ctx.Args().First()
|
||||
if hashish(arg) {
|
||||
hash := common.HexToHash(arg)
|
||||
if number := rawdb.ReadHeaderNumber(db, hash); number != nil {
|
||||
header = rawdb.ReadHeader(db, hash, *number)
|
||||
if number, ok := rawdb.ReadHeaderNumber(db, hash); ok {
|
||||
header = rawdb.ReadHeader(db, hash, number)
|
||||
} else {
|
||||
return nil, common.Hash{}, fmt.Errorf("block %x not found", hash)
|
||||
}
|
||||
|
|
@ -716,7 +716,7 @@ func downloadEra(ctx *cli.Context) error {
|
|||
case ctx.IsSet(utils.SepoliaFlag.Name):
|
||||
network = "sepolia"
|
||||
default:
|
||||
return fmt.Errorf("unsupported network, no known era1 checksums")
|
||||
return errors.New("unsupported network, no known era1 checksums")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,14 +262,16 @@ func makeFullNode(ctx *cli.Context) *node.Node {
|
|||
if cfg.Ethstats.URL != "" {
|
||||
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
|
||||
}
|
||||
// Configure full-sync tester service if requested
|
||||
// Configure synchronization override service
|
||||
var synctarget common.Hash
|
||||
if ctx.IsSet(utils.SyncTargetFlag.Name) {
|
||||
hex := hexutil.MustDecode(ctx.String(utils.SyncTargetFlag.Name))
|
||||
if len(hex) != common.HashLength {
|
||||
utils.Fatalf("invalid sync target length: have %d, want %d", len(hex), common.HashLength)
|
||||
}
|
||||
utils.RegisterFullSyncTester(stack, eth, common.BytesToHash(hex))
|
||||
synctarget = common.BytesToHash(hex)
|
||||
}
|
||||
utils.RegisterSyncOverrideService(stack, eth, synctarget, ctx.Bool(utils.ExitWhenSyncedFlag.Name))
|
||||
|
||||
if ctx.IsSet(utils.DeveloperFlag.Name) {
|
||||
// Start dev mode.
|
||||
|
|
|
|||
161
cmd/geth/testdata/vcheck/data.json
vendored
161
cmd/geth/testdata/vcheck/data.json
vendored
|
|
@ -6,28 +6,33 @@
|
|||
"description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/pull/21793",
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49"
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-v592-xf75-856p"
|
||||
],
|
||||
"introduced": "v1.6.0",
|
||||
"fixed": "v1.9.24",
|
||||
"published": "2020-11-12",
|
||||
"severity": "Medium",
|
||||
"check": "Geth\\/v1\\.(6|7|8)\\..*|Geth\\/v1\\.9\\.2(1|2|3)-.*"
|
||||
"CVE": "CVE-2020-26240",
|
||||
"check": "Geth\\/v1\\.(6|7|8)\\..*|Geth\\/v1\\.9\\.\\d-.*|Geth\\/v1\\.9\\.1.*|Geth\\/v1\\.9\\.2(0|1|2|3)-.*"
|
||||
},
|
||||
{
|
||||
"name": "GoCrash",
|
||||
"name": "Denial of service due to Go CVE-2020-28362",
|
||||
"uid": "GETH-2020-02",
|
||||
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`",
|
||||
"description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETC’s core-geth) which is built with versions of Go which contains the vulnerability.",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM",
|
||||
"https://github.com/golang/go/issues/42552"
|
||||
"https://github.com/golang/go/issues/42552",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-m6gx-rhvj-fh52"
|
||||
],
|
||||
"introduced": "v0.0.0",
|
||||
"fixed": "v1.9.24",
|
||||
"published": "2020-11-12",
|
||||
"severity": "Critical",
|
||||
"CVE": "CVE-2020-28362",
|
||||
"check": "Geth.*\\/go1\\.(11(.*)|12(.*)|13(.*)|14|14\\.(\\d|10|11|)|15|15\\.[0-4])$"
|
||||
},
|
||||
{
|
||||
|
|
@ -36,26 +41,162 @@
|
|||
"summary": "A consensus flaw in Geth, related to `datacopy` precompile",
|
||||
"description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/"
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-69v6-xc2j-r2jf"
|
||||
],
|
||||
"introduced": "v1.9.7",
|
||||
"fixed": "v1.9.17",
|
||||
"published": "2020-11-12",
|
||||
"severity": "Critical",
|
||||
"CVE": "CVE-2020-26241",
|
||||
"check": "Geth\\/v1\\.9\\.(7|8|9|10|11|12|13|14|15|16).*$"
|
||||
},
|
||||
{
|
||||
"name": "GethCrash",
|
||||
"name": "Geth DoS via MULMOD",
|
||||
"uid": "GETH-2020-04",
|
||||
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing",
|
||||
"description": "Full details to be disclosed at a later date",
|
||||
"description": "Affected versions suffer from a vulnerability which can be exploited through the `MULMOD` operation, by specifying a modulo of `0`: `mulmod(a,b,0)`, causing a `panic` in the underlying library. \nThe crash was in the `uint256` library, where a buffer [underflowed](https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L442).\n\n\tif `d == 0`, `dLen` remains `0`\n\nand https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L451 will try to access index `[-1]`.\n\nThe `uint256` library was first merged in this [commit](https://github.com/ethereum/go-ethereum/commit/cf6674539c589f80031f3371a71c6a80addbe454), on 2020-06-08. \nExploiting this vulnerabilty would cause all vulnerable nodes to drop off the network. \n\nThe issue was brought to our attention through a [bug report](https://github.com/ethereum/go-ethereum/issues/21367), showing a `panic` occurring on sync from genesis on the Ropsten network.\n \nIt was estimated that the least obvious way to fix this would be to merge the fix into `uint256`, make a new release of that library and then update the geth-dependency.\n",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/"
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m",
|
||||
"https://github.com/holiman/uint256/releases/tag/v1.1.1",
|
||||
"https://github.com/holiman/uint256/pull/80",
|
||||
"https://github.com/ethereum/go-ethereum/pull/21368"
|
||||
],
|
||||
"introduced": "v1.9.16",
|
||||
"fixed": "v1.9.18",
|
||||
"published": "2020-11-12",
|
||||
"severity": "Critical",
|
||||
"CVE": "CVE-2020-26242",
|
||||
"check": "Geth\\/v1\\.9.(16|17).*$"
|
||||
},
|
||||
{
|
||||
"name": "LES Server DoS via GetProofsV2",
|
||||
"uid": "GETH-2020-05",
|
||||
"summary": "A DoS vulnerability can make a LES server crash.",
|
||||
"description": "A DoS vulnerability can make a LES server crash via malicious GetProofsV2 request from a connected LES client.\n\nThe vulnerability was patched in #21896.\n\nThis vulnerability only concern users explicitly running geth as a light server",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-r33q-22hv-j29q",
|
||||
"https://github.com/ethereum/go-ethereum/pull/21896"
|
||||
],
|
||||
"introduced": "v1.8.0",
|
||||
"fixed": "v1.9.25",
|
||||
"published": "2020-12-10",
|
||||
"severity": "Medium",
|
||||
"CVE": "CVE-2020-26264",
|
||||
"check": "(Geth\\/v1\\.8\\.*)|(Geth\\/v1\\.9\\.\\d-.*)|(Geth\\/v1\\.9\\.1\\d-.*)|(Geth\\/v1\\.9\\.(20|21|22|23|24)-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "SELFDESTRUCT-recreate consensus flaw",
|
||||
"uid": "GETH-2020-06",
|
||||
"introduced": "v1.9.4",
|
||||
"fixed": "v1.9.20",
|
||||
"summary": "A consensus-vulnerability in Geth could cause a chain split, where vulnerable versions refuse to accept the canonical chain.",
|
||||
"description": "A flaw was repoted at 2020-08-11 by John Youngseok Yang (Software Platform Lab), where a particular sequence of transactions could cause a consensus failure.\n\n- Tx 1:\n - `sender` invokes `caller`.\n - `caller` invokes `0xaa`. `0xaa` has 3 wei, does a self-destruct-to-self\n - `caller` does a `1 wei` -call to `0xaa`, who thereby has 1 wei (the code in `0xaa` still executed, since the tx is still ongoing, but doesn't redo the selfdestruct, it takes a different path if callvalue is non-zero)\n\n-Tx 2:\n - `sender` does a 5-wei call to 0xaa. No exec (since no code). \n\nIn geth, the result would be that `0xaa` had `6 wei`, whereas OE reported (correctly) `5` wei. Furthermore, in geth, if the second tx was not executed, the `0xaa` would be destructed, resulting in `0 wei`. Thus obviously wrong. \n\nIt was determined that the root cause was this [commit](https://github.com/ethereum/go-ethereum/commit/223b950944f494a5b4e0957fd9f92c48b09037ad) from [this PR](https://github.com/ethereum/go-ethereum/pull/19953). The semantics of `createObject` was subtly changd, into returning a non-nil object (with `deleted=true`) where it previously did not if the account had been destructed. This return value caused the new object to inherit the old `balance`.\n",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-xw37-57qp-9mm4"
|
||||
],
|
||||
"published": "2020-12-10",
|
||||
"severity": "High",
|
||||
"CVE": "CVE-2020-26265",
|
||||
"check": "(Geth\\/v1\\.9\\.(4|5|6|7|8|9)-.*)|(Geth\\/v1\\.9\\.1\\d-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "Not ready for London upgrade",
|
||||
"uid": "GETH-2021-01",
|
||||
"summary": "The client is not ready for the 'London' technical upgrade, and will deviate from the canonical chain when the London upgrade occurs (at block '12965000' around August 4, 2021.",
|
||||
"description": "At (or around) August 4, Ethereum will undergo a technical upgrade called 'London'. Clients not upgraded will fail to progress on the canonical chain.",
|
||||
"links": [
|
||||
"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",
|
||||
"https://notes.ethereum.org/@timbeiko/ropsten-postmortem"
|
||||
],
|
||||
"introduced": "v1.10.1",
|
||||
"fixed": "v1.10.6",
|
||||
"published": "2021-07-22",
|
||||
"severity": "High",
|
||||
"check": "(Geth\\/v1\\.10\\.(1|2|3|4|5)-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "RETURNDATA corruption via datacopy",
|
||||
"uid": "GETH-2021-02",
|
||||
"summary": "A consensus-flaw in the Geth EVM could cause a node to deviate from the canonical chain.",
|
||||
"description": "A memory-corruption bug within the EVM can cause a consensus error, where vulnerable nodes obtain a different `stateRoot` when processing a maliciously crafted transaction. This, in turn, would lead to the chain being split: mainnet splitting in two forks.\n\nAll Geth versions supporting the London hard fork are vulnerable (the bug is older than London), so all users should update.\n\nThis bug was exploited on Mainnet at block 13107518.\n\nCredits for the discovery go to @guidovranken (working for Sentnl during an audit of the Telos EVM) and reported via bounty@ethereum.org.",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/blob/master/docs/postmortems/2021-08-22-split-postmortem.md",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-9856-9gg9-qcmq",
|
||||
"https://github.com/ethereum/go-ethereum/releases/tag/v1.10.8"
|
||||
],
|
||||
"introduced": "v1.10.0",
|
||||
"fixed": "v1.10.8",
|
||||
"published": "2021-08-24",
|
||||
"severity": "High",
|
||||
"CVE": "CVE-2021-39137",
|
||||
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7)-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "DoS via malicious `snap/1` request",
|
||||
"uid": "GETH-2021-03",
|
||||
"summary": "A vulnerable node is susceptible to crash when processing a maliciously crafted message from a peer, via the snap/1 protocol. The crash can be triggered by sending a malicious snap/1 GetTrieNodes package.",
|
||||
"description": "The `snap/1` protocol handler contains two vulnerabilities related to the `GetTrieNodes` packet, which can be exploited to crash the node. Full details are available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-59hh-656j-3p7v)",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-59hh-656j-3p7v",
|
||||
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities",
|
||||
"https://github.com/ethereum/go-ethereum/pull/23657"
|
||||
],
|
||||
"introduced": "v1.10.0",
|
||||
"fixed": "v1.10.9",
|
||||
"published": "2021-10-24",
|
||||
"severity": "Medium",
|
||||
"CVE": "CVE-2021-41173",
|
||||
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7|8)-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "DoS via malicious p2p message",
|
||||
"uid": "GETH-2022-01",
|
||||
"summary": "A vulnerable node can crash via p2p messages sent from an attacker node, if running with non-default log options.",
|
||||
"description": "A vulnerable node, if configured to use high verbosity logging, can be made to crash when handling specially crafted p2p messages sent from an attacker node. Full details are available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-wjxw-gh3m-7pm5)",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-wjxw-gh3m-7pm5",
|
||||
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities",
|
||||
"https://github.com/ethereum/go-ethereum/pull/24507"
|
||||
],
|
||||
"introduced": "v1.10.0",
|
||||
"fixed": "v1.10.17",
|
||||
"published": "2022-05-11",
|
||||
"severity": "Low",
|
||||
"CVE": "CVE-2022-29177",
|
||||
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16)-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "DoS via malicious p2p message",
|
||||
"uid": "GETH-2023-01",
|
||||
"summary": "A vulnerable node can be made to consume unbounded amounts of memory when handling specially crafted p2p messages sent from an attacker node.",
|
||||
"description": "The p2p handler spawned a new goroutine to respond to ping requests. By flooding a node with ping requests, an unbounded number of goroutines can be created, leading to resource exhaustion and potentially crash due to OOM.",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-ppjg-v974-84cm",
|
||||
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities"
|
||||
],
|
||||
"introduced": "v1.10.0",
|
||||
"fixed": "v1.12.1",
|
||||
"published": "2023-09-06",
|
||||
"severity": "High",
|
||||
"CVE": "CVE-2023-40591",
|
||||
"check": "(Geth\\/v1\\.(10|11)\\..*)|(Geth\\/v1\\.12\\.0-.*)$"
|
||||
},
|
||||
{
|
||||
"name": "DoS via malicious p2p message",
|
||||
"uid": "GETH-2024-01",
|
||||
"summary": "A vulnerable node can be made to consume very large amounts of memory when handling specially crafted p2p messages sent from an attacker node.",
|
||||
"description": "A vulnerable node can be made to consume very large amounts of memory when handling specially crafted p2p messages sent from an attacker node. Full details will be available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-4xc9-8hmq-j652)",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-4xc9-8hmq-j652",
|
||||
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities"
|
||||
],
|
||||
"introduced": "v1.10.0",
|
||||
"fixed": "v1.13.15",
|
||||
"published": "2024-05-06",
|
||||
"severity": "High",
|
||||
"CVE": "CVE-2024-32972",
|
||||
"check": "(Geth\\/v1\\.(10|11|12)\\..*)|(Geth\\/v1\\.13\\.\\d-.*)|(Geth\\/v1\\.13\\.1(0|1|2|3|4)-.*)$"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
untrusted comment: signature from minisign secret key
|
||||
RUQkliYstQBOKLK05Sy5f3bVRMBqJT26ABo6Vbp3BNJAVjejoqYCu4GWE/+7qcDfHBqYIniDCbFIUvYEnOHxV6vZ93wO1xJWDQw=
|
||||
trusted comment: timestamp:1693986492 file:data.json hashed
|
||||
6Fdw2H+W1ZXK7QXSF77Z5AWC7+AEFAfDmTSxNGylU5HLT1AuSJQmxslj+VjtUBamYCvOuET7plbXza942AlWDw==
|
||||
RUQkliYstQBOKHklFEYCUjepz81dyUuDmIAxjAvXa+icjGuKcjtVfV06G7qfOMSpplS5EcntU12n+AnGNyuOM8zIctaIWcfG2w0=
|
||||
trusted comment: timestamp:1752094689 file:data.json hashed
|
||||
u2e4wo4HBTU6viQTSY/NVBHoWoPFJnnTvLZS0FYl3JdvSOYi6+qpbEsDhAIFqq/n8VmlS/fPqqf7vKCNiAgjAA==
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
untrusted comment: signature from minisign secret key
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
trusted comment: timestamp:1605618622 file:vulnerabilities.json
|
||||
osAPs4QPdDkmiWQxqeMIzYv/b+ZGxJ+19Sbrk1Cpq4t2gHBT+lqFtwL3OCzKWWyjGRTmHfsVGBYpzEdPRQ0/BQ==
|
||||
RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
|
||||
trusted comment: timestamp:1752094703 file:data.json
|
||||
cNyq3ZGlqo785HtWODb9ejWqF0HhSeXuLGXzC7z1IhnDrBObWBJngYd3qBG1dQcYlHQ+bgB/On5mSyMFn4UoCQ==
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
untrusted comment: Here's a comment
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
|
||||
trusted comment: Here's a trusted comment
|
||||
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==
|
||||
dL7lO8sqFFCOXJO/u8SgoDk2nlXGWPRDbOTJkChMbmtUp9PB7sG831basXkZ/0CQ/l/vG7AbPyMNEVZyJn5NCg==
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
untrusted comment: One more (untrusted) comment
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
untrusted comment: One more (untrusted™) comment
|
||||
RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
|
||||
trusted comment: Here's a trusted comment
|
||||
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==
|
||||
dL7lO8sqFFCOXJO/u8SgoDk2nlXGWPRDbOTJkChMbmtUp9PB7sG831basXkZ/0CQ/l/vG7AbPyMNEVZyJn5NCg==
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
untrusted comment: verify with ./signifykey.pub
|
||||
RWSKLNhZb0KdAbhRUhW2LQZXdnwttu2SYhM9EuC4mMgOJB85h7/YIPupf8/ldTs4N8e9Y/fhgdY40q5LQpt5IFC62fq0v8U1/w8=
|
||||
untrusted comment: verify with signifykey.pub
|
||||
RWSKLNhZb0KdARbMcGN40hbHzKQYZDgDOFhEUT1YpzMnqre/mbKJ8td/HVlG03Am1YCszATiI0DbnljjTy4iNHYwqBfzrFUqUg0=
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
untrusted comment: signature from minisign secret key
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
trusted comment: timestamp:1605618622 file:vulnerabilities.json
|
||||
osAPs4QPdDkmiWQxqeMIzYv/b+ZGxJ+19Sbrk1Cpq4t2gHBT+lqFtwL3OCzKWWyjGRTmHfsVGBYpzEdPRQ0/BQ==
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
untrusted comment: Here's a comment
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
trusted comment: Here's a trusted comment
|
||||
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
untrusted comment: One more (untrusted) comment
|
||||
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
|
||||
trusted comment: Here's a trusted comment
|
||||
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
"description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.",
|
||||
"links": [
|
||||
"https://github.com/ethereum/go-ethereum/pull/21793",
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-v592-xf75-856p"
|
||||
],
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`",
|
||||
"description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETC’s core-geth) which is built with versions of Go which contains the vulnerability.",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM",
|
||||
"https://github.com/golang/go/issues/42552",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-m6gx-rhvj-fh52"
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
"summary": "A consensus flaw in Geth, related to `datacopy` precompile",
|
||||
"description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-69v6-xc2j-r2jf"
|
||||
],
|
||||
"introduced": "v1.9.7",
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing",
|
||||
"description": "Affected versions suffer from a vulnerability which can be exploited through the `MULMOD` operation, by specifying a modulo of `0`: `mulmod(a,b,0)`, causing a `panic` in the underlying library. \nThe crash was in the `uint256` library, where a buffer [underflowed](https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L442).\n\n\tif `d == 0`, `dLen` remains `0`\n\nand https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L451 will try to access index `[-1]`.\n\nThe `uint256` library was first merged in this [commit](https://github.com/ethereum/go-ethereum/commit/cf6674539c589f80031f3371a71c6a80addbe454), on 2020-06-08. \nExploiting this vulnerabilty would cause all vulnerable nodes to drop off the network. \n\nThe issue was brought to our attention through a [bug report](https://github.com/ethereum/go-ethereum/issues/21367), showing a `panic` occurring on sync from genesis on the Ropsten network.\n \nIt was estimated that the least obvious way to fix this would be to merge the fix into `uint256`, make a new release of that library and then update the geth-dependency.\n",
|
||||
"links": [
|
||||
"https://blog.ethereum.org/2020/11/12/geth_security_release/",
|
||||
"https://blog.ethereum.org/2020/11/12/geth-security-release",
|
||||
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m",
|
||||
"https://github.com/holiman/uint256/releases/tag/v1.1.1",
|
||||
"https://github.com/holiman/uint256/pull/80",
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ func TestVerification(t *testing.T) {
|
|||
t.Parallel()
|
||||
// For this test, the pubkey is in testdata/vcheck/minisign.pub
|
||||
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
|
||||
// 1. `minisign -S -l -s ./minisign.sec -m data.json -x ./minisig-sigs/vulnerabilities.json.minisig.1 -c "signature from minisign secret key"`
|
||||
// 2. `minisign -S -l -s ./minisign.sec -m vulnerabilities.json -x ./minisig-sigs/vulnerabilities.json.minisig.2 -c "Here's a comment" -t "Here's a trusted comment"`
|
||||
// 3. minisign -S -l -s ./minisign.sec -m vulnerabilities.json -x ./minisig-sigs/vulnerabilities.json.minisig.3 -c "One more (untrusted™) comment" -t "Here's a trusted comment"
|
||||
pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp"
|
||||
testVerification(t, pub, "./testdata/vcheck/minisig-sigs/")
|
||||
})
|
||||
|
|
@ -43,7 +46,7 @@ func TestVerification(t *testing.T) {
|
|||
t.Parallel()
|
||||
// For this test, the pubkey is in testdata/vcheck/minisign.pub
|
||||
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
|
||||
// `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig`
|
||||
// `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig`
|
||||
pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp"
|
||||
testVerification(t, pub, "./testdata/vcheck/minisig-sigs-new/")
|
||||
})
|
||||
|
|
@ -53,6 +56,7 @@ func TestVerification(t *testing.T) {
|
|||
t.Skip("This currently fails, minisign expects 4 lines of data, signify provides only 2")
|
||||
// For this test, the pubkey is in testdata/vcheck/signifykey.pub
|
||||
// (the privkey is `signifykey.sec`, if we want to expand this test. Password 'test' )
|
||||
// `signify -S -s signifykey.sec -m data.json -x ./signify-sigs/data.json.sig`
|
||||
pub := "RWSKLNhZb0KdATtRT7mZC/bybI3t3+Hv/O2i3ye04Dq9fnT9slpZ1a2/"
|
||||
testVerification(t, pub, "./testdata/vcheck/signify-sigs/")
|
||||
})
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/crypto/kzg4844"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/eth/catalyst"
|
||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
||||
"github.com/ethereum/go-ethereum/eth/filters"
|
||||
"github.com/ethereum/go-ethereum/eth/gasprice"
|
||||
"github.com/ethereum/go-ethereum/eth/syncer"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/ethdb/remotedb"
|
||||
|
|
@ -261,7 +261,7 @@ var (
|
|||
}
|
||||
GCModeFlag = &cli.StringFlag{
|
||||
Name: "gcmode",
|
||||
Usage: `Blockchain garbage collection mode, only relevant in state.scheme=hash ("full", "archive")`,
|
||||
Usage: `Blockchain garbage collection mode ("full", "archive")`,
|
||||
Value: "full",
|
||||
Category: flags.StateCategory,
|
||||
}
|
||||
|
|
@ -1379,13 +1379,13 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(NoUSBFlag.Name) || cfg.NoUSB {
|
||||
log.Warn("Option nousb is deprecated and USB is deactivated by default. Use --usb to enable")
|
||||
log.Warn("Option --nousb is deprecated and USB is deactivated by default. Use --usb to enable")
|
||||
}
|
||||
if ctx.IsSet(USBFlag.Name) {
|
||||
cfg.USB = ctx.Bool(USBFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(InsecureUnlockAllowedFlag.Name) {
|
||||
log.Warn(fmt.Sprintf("Option %q is deprecated and has no effect", InsecureUnlockAllowedFlag.Name))
|
||||
log.Warn(fmt.Sprintf("Option --%s is deprecated and has no effect", InsecureUnlockAllowedFlag.Name))
|
||||
}
|
||||
if ctx.IsSet(DBEngineFlag.Name) {
|
||||
dbEngine := ctx.String(DBEngineFlag.Name)
|
||||
|
|
@ -1397,10 +1397,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
}
|
||||
// deprecation notice for log debug flags (TODO: find a more appropriate place to put these?)
|
||||
if ctx.IsSet(LogBacktraceAtFlag.Name) {
|
||||
log.Warn("log.backtrace flag is deprecated")
|
||||
log.Warn("Option --log.backtrace flag is deprecated")
|
||||
}
|
||||
if ctx.IsSet(LogDebugFlag.Name) {
|
||||
log.Warn("log.debug flag is deprecated")
|
||||
log.Warn("Option --log.debug flag is deprecated")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1859,7 +1859,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
func MakeBeaconLightConfig(ctx *cli.Context) bparams.ClientConfig {
|
||||
var config bparams.ClientConfig
|
||||
customConfig := ctx.IsSet(BeaconConfigFlag.Name)
|
||||
flags.CheckExclusive(ctx, MainnetFlag, SepoliaFlag, HoleskyFlag, BeaconConfigFlag)
|
||||
flags.CheckExclusive(ctx, MainnetFlag, SepoliaFlag, HoleskyFlag, HoodiFlag, BeaconConfigFlag)
|
||||
switch {
|
||||
case ctx.Bool(MainnetFlag.Name):
|
||||
config.ChainConfig = *bparams.MainnetLightConfig
|
||||
|
|
@ -1997,10 +1997,14 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
|
|||
return filterSystem
|
||||
}
|
||||
|
||||
// RegisterFullSyncTester adds the full-sync tester service into node.
|
||||
func RegisterFullSyncTester(stack *node.Node, eth *eth.Ethereum, target common.Hash) {
|
||||
catalyst.RegisterFullSyncTester(stack, eth, target)
|
||||
log.Info("Registered full-sync tester", "hash", target)
|
||||
// RegisterSyncOverrideService adds the synchronization override service into node.
|
||||
func RegisterSyncOverrideService(stack *node.Node, eth *eth.Ethereum, target common.Hash, exitWhenSynced bool) {
|
||||
if target != (common.Hash{}) {
|
||||
log.Info("Registered sync override service", "hash", target, "exitWhenSynced", exitWhenSynced)
|
||||
} else {
|
||||
log.Info("Registered sync override service")
|
||||
}
|
||||
syncer.Register(stack, eth, target, exitWhenSynced)
|
||||
}
|
||||
|
||||
// SetupMetrics configures the metrics system.
|
||||
|
|
@ -2198,6 +2202,12 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
|||
StateHistory: ctx.Uint64(StateHistoryFlag.Name),
|
||||
// Disable transaction indexing/unindexing.
|
||||
TxLookupLimit: -1,
|
||||
|
||||
// Enables file journaling for the trie database. The journal files will be stored
|
||||
// within the data directory. The corresponding paths will be either:
|
||||
// - DATADIR/triedb/merkle.journal
|
||||
// - DATADIR/triedb/verkle.journal
|
||||
TrieJournalDirectory: stack.ResolvePath("triedb"),
|
||||
}
|
||||
if options.ArchiveMode && !options.Preimages {
|
||||
options.Preimages = true
|
||||
|
|
|
|||
|
|
@ -44,40 +44,50 @@ var DeprecatedFlags = []cli.Flag{
|
|||
MinerNewPayloadTimeoutFlag,
|
||||
MinerEtherbaseFlag,
|
||||
MiningEnabledFlag,
|
||||
MetricsEnabledExpensiveFlag,
|
||||
EnablePersonal,
|
||||
UnlockedAccountFlag,
|
||||
InsecureUnlockAllowedFlag,
|
||||
}
|
||||
|
||||
var (
|
||||
// Deprecated May 2020, shown in aliased flags section
|
||||
NoUSBFlag = &cli.BoolFlag{
|
||||
Name: "nousb",
|
||||
Hidden: true,
|
||||
Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated March 2022
|
||||
LegacyWhitelistFlag = &cli.StringFlag{
|
||||
Name: "whitelist",
|
||||
Hidden: true,
|
||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated July 2023
|
||||
CacheTrieJournalFlag = &cli.StringFlag{
|
||||
Name: "cache.trie.journal",
|
||||
Hidden: true,
|
||||
Usage: "Disk journal directory for trie cache to survive node restarts",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
CacheTrieRejournalFlag = &cli.DurationFlag{
|
||||
Name: "cache.trie.rejournal",
|
||||
Hidden: true,
|
||||
Usage: "Time interval to regenerate the trie cache journal",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
LegacyDiscoveryV5Flag = &cli.BoolFlag{
|
||||
Name: "v5disc",
|
||||
Hidden: true,
|
||||
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated August 2023
|
||||
TxLookupLimitFlag = &cli.Uint64Flag{
|
||||
Name: "txlookuplimit",
|
||||
Hidden: true,
|
||||
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (deprecated, use history.transactions instead)",
|
||||
Value: ethconfig.Defaults.TransactionHistory,
|
||||
Category: flags.DeprecatedCategory,
|
||||
|
|
@ -85,51 +95,60 @@ var (
|
|||
// Deprecated November 2023
|
||||
LogBacktraceAtFlag = &cli.StringFlag{
|
||||
Name: "log.backtrace",
|
||||
Hidden: true,
|
||||
Usage: "Request a stack trace at a specific logging statement (deprecated)",
|
||||
Value: "",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
LogDebugFlag = &cli.BoolFlag{
|
||||
Name: "log.debug",
|
||||
Hidden: true,
|
||||
Usage: "Prepends log messages with call-site location (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated February 2024
|
||||
MinerNewPayloadTimeoutFlag = &cli.DurationFlag{
|
||||
Name: "miner.newpayload-timeout",
|
||||
Hidden: true,
|
||||
Usage: "Specify the maximum time allowance for creating a new payload (deprecated)",
|
||||
Value: ethconfig.Defaults.Miner.Recommit,
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
MinerEtherbaseFlag = &cli.StringFlag{
|
||||
Name: "miner.etherbase",
|
||||
Hidden: true,
|
||||
Usage: "0x prefixed public address for block mining rewards (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
MiningEnabledFlag = &cli.BoolFlag{
|
||||
Name: "mine",
|
||||
Hidden: true,
|
||||
Usage: "Enable mining (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
MetricsEnabledExpensiveFlag = &cli.BoolFlag{
|
||||
Name: "metrics.expensive",
|
||||
Hidden: true,
|
||||
Usage: "Enable expensive metrics collection and reporting (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
// Deprecated Oct 2024
|
||||
EnablePersonal = &cli.BoolFlag{
|
||||
Name: "rpc.enabledeprecatedpersonal",
|
||||
Hidden: true,
|
||||
Usage: "This used to enable the 'personal' namespace.",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
UnlockedAccountFlag = &cli.StringFlag{
|
||||
Name: "unlock",
|
||||
Hidden: true,
|
||||
Usage: "Comma separated list of accounts to unlock (deprecated)",
|
||||
Value: "",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
InsecureUnlockAllowedFlag = &cli.BoolFlag{
|
||||
Name: "allow-insecure-unlock",
|
||||
Hidden: true,
|
||||
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http (deprecated)",
|
||||
Category: flags.DeprecatedCategory,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@ and `eth_getBlockByNumber`, use this command:
|
|||
> ./workload test --sepolia --run History/getBlockBy http://host:8545
|
||||
```
|
||||
|
||||
Notably, trace tests require archive which keeps all the historical states for tracing.
|
||||
The additional flag is required to activate the trace tests.
|
||||
|
||||
```
|
||||
> ./workload test --sepolia --archive --run Trace/Block http://host:8545
|
||||
```
|
||||
|
||||
### Regenerating tests
|
||||
|
||||
There is a facility for updating the tests from the chain. This can also be used to
|
||||
|
|
@ -26,5 +33,5 @@ the following commands (in this directory) against a synced mainnet node:
|
|||
```shell
|
||||
> go run . filtergen --queries queries/filter_queries_mainnet.json http://host:8545
|
||||
> go run . historygen --history-tests queries/history_mainnet.json http://host:8545
|
||||
> go run . tracegen --trace-tests queries/trace_mainnet.json http://host:8545
|
||||
> go run . tracegen --trace-tests queries/trace_mainnet.json --trace-start 4000000 --trace-end 4000100 http://host:8545
|
||||
```
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
|
|
@ -153,7 +154,14 @@ func (s *filterTestSuite) fullRangeQueryAndCheck(t *utesting.T, query *filterQue
|
|||
func (s *filterTestSuite) loadQueries() error {
|
||||
file, err := s.cfg.fsys.Open(s.cfg.filterQueryFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open filterQueryFile: %v", err)
|
||||
// If not found in embedded FS, try to load it from disk
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
file, err = os.OpenFile(s.cfg.filterQueryFile, os.O_RDONLY, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open filterQueryFile: %v", err)
|
||||
}
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
@ -52,7 +53,14 @@ func newHistoryTestSuite(cfg testConfig) *historyTestSuite {
|
|||
func (s *historyTestSuite) loadTests() error {
|
||||
file, err := s.cfg.fsys.Open(s.cfg.historyTestFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open historyTestFile: %v", err)
|
||||
// If not found in embedded FS, try to load it from disk
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
file, err = os.OpenFile(s.cfg.historyTestFile, os.O_RDONLY, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open historyTestFile: %v", err)
|
||||
}
|
||||
}
|
||||
defer file.Close()
|
||||
if err := json.NewDecoder(file).Decode(&s.tests); err != nil {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -137,11 +138,17 @@ func calcReceiptsHash(rcpt []*types.Receipt) common.Hash {
|
|||
}
|
||||
|
||||
func writeJSON(fileName string, value any) {
|
||||
// Ensure the directory exists
|
||||
dir := filepath.Dir(fileName)
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
exit(fmt.Errorf("failed to create directories: %w", err))
|
||||
}
|
||||
file, err := os.Create(fileName)
|
||||
if err != nil {
|
||||
exit(fmt.Errorf("error creating %s: %v", fileName, err))
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
json.NewEncoder(file).Encode(value)
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@ package main
|
|||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ type testConfig struct {
|
|||
traceTestFile string
|
||||
}
|
||||
|
||||
var errPrunedHistory = fmt.Errorf("attempt to access pruned history")
|
||||
var errPrunedHistory = errors.New("attempt to access pruned history")
|
||||
|
||||
// validateHistoryPruneErr checks whether the given error is caused by access
|
||||
// to history before the pruning threshold block (it is an rpc.Error with code 4444).
|
||||
|
|
@ -109,7 +109,7 @@ func validateHistoryPruneErr(err error, blockNum uint64, historyPruneBlock *uint
|
|||
if err != nil {
|
||||
if rpcErr, ok := err.(rpc.Error); ok && rpcErr.ErrorCode() == 4444 {
|
||||
if historyPruneBlock != nil && blockNum > *historyPruneBlock {
|
||||
return fmt.Errorf("pruned history error returned after pruning threshold")
|
||||
return errors.New("pruned history error returned after pruning threshold")
|
||||
}
|
||||
return errPrunedHistory
|
||||
}
|
||||
|
|
@ -130,18 +130,42 @@ func testConfigFromCLI(ctx *cli.Context) (cfg testConfig) {
|
|||
switch {
|
||||
case ctx.Bool(testMainnetFlag.Name):
|
||||
cfg.fsys = builtinTestFiles
|
||||
cfg.filterQueryFile = "queries/filter_queries_mainnet.json"
|
||||
cfg.historyTestFile = "queries/history_mainnet.json"
|
||||
if ctx.IsSet(filterQueryFileFlag.Name) {
|
||||
cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)
|
||||
} else {
|
||||
cfg.filterQueryFile = "queries/filter_queries_mainnet.json"
|
||||
}
|
||||
if ctx.IsSet(historyTestFileFlag.Name) {
|
||||
cfg.historyTestFile = ctx.String(historyTestFileFlag.Name)
|
||||
} else {
|
||||
cfg.historyTestFile = "queries/history_mainnet.json"
|
||||
}
|
||||
if ctx.IsSet(traceTestFileFlag.Name) {
|
||||
cfg.traceTestFile = ctx.String(traceTestFileFlag.Name)
|
||||
} else {
|
||||
cfg.traceTestFile = "queries/trace_mainnet.json"
|
||||
}
|
||||
cfg.historyPruneBlock = new(uint64)
|
||||
*cfg.historyPruneBlock = history.PrunePoints[params.MainnetGenesisHash].BlockNumber
|
||||
cfg.traceTestFile = "queries/trace_mainnet.json"
|
||||
case ctx.Bool(testSepoliaFlag.Name):
|
||||
cfg.fsys = builtinTestFiles
|
||||
cfg.filterQueryFile = "queries/filter_queries_sepolia.json"
|
||||
cfg.historyTestFile = "queries/history_sepolia.json"
|
||||
if ctx.IsSet(filterQueryFileFlag.Name) {
|
||||
cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)
|
||||
} else {
|
||||
cfg.filterQueryFile = "queries/filter_queries_sepolia.json"
|
||||
}
|
||||
if ctx.IsSet(historyTestFileFlag.Name) {
|
||||
cfg.historyTestFile = ctx.String(historyTestFileFlag.Name)
|
||||
} else {
|
||||
cfg.historyTestFile = "queries/history_sepolia.json"
|
||||
}
|
||||
if ctx.IsSet(traceTestFileFlag.Name) {
|
||||
cfg.traceTestFile = ctx.String(traceTestFileFlag.Name)
|
||||
} else {
|
||||
cfg.traceTestFile = "queries/trace_sepolia.json"
|
||||
}
|
||||
cfg.historyPruneBlock = new(uint64)
|
||||
*cfg.historyPruneBlock = history.PrunePoints[params.SepoliaGenesisHash].BlockNumber
|
||||
cfg.traceTestFile = "queries/trace_sepolia.json"
|
||||
default:
|
||||
cfg.fsys = os.DirFS(".")
|
||||
cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import (
|
|||
|
||||
// traceTest is the content of a history test.
|
||||
type traceTest struct {
|
||||
TxHashes []common.Hash `json:"txHashes"`
|
||||
BlockHashes []common.Hash `json:"blockHashes"`
|
||||
TraceConfigs []tracers.TraceConfig `json:"traceConfigs"`
|
||||
ResultHashes []common.Hash `json:"resultHashes"`
|
||||
}
|
||||
|
|
@ -58,14 +58,20 @@ func newTraceTestSuite(cfg testConfig, ctx *cli.Context) *traceTestSuite {
|
|||
func (s *traceTestSuite) loadTests() error {
|
||||
file, err := s.cfg.fsys.Open(s.cfg.traceTestFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open traceTestFile: %v", err)
|
||||
// If not found in embedded FS, try to load it from disk
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
file, err = os.OpenFile(s.cfg.traceTestFile, os.O_RDONLY, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open traceTestFile: %v", err)
|
||||
}
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
if err := json.NewDecoder(file).Decode(&s.tests); err != nil {
|
||||
return fmt.Errorf("invalid JSON in %s: %v", s.cfg.traceTestFile, err)
|
||||
}
|
||||
if len(s.tests.TxHashes) == 0 {
|
||||
if len(s.tests.BlockHashes) == 0 {
|
||||
return fmt.Errorf("traceTestFile %s has no test data", s.cfg.traceTestFile)
|
||||
}
|
||||
return nil
|
||||
|
|
@ -73,17 +79,17 @@ func (s *traceTestSuite) loadTests() error {
|
|||
|
||||
func (s *traceTestSuite) allTests() []workloadTest {
|
||||
return []workloadTest{
|
||||
newArchiveWorkloadTest("Trace/Transaction", s.traceTransaction),
|
||||
newArchiveWorkloadTest("Trace/Block", s.traceBlock),
|
||||
}
|
||||
}
|
||||
|
||||
// traceTransaction runs all transaction tracing tests
|
||||
func (s *traceTestSuite) traceTransaction(t *utesting.T) {
|
||||
// traceBlock runs all block tracing tests
|
||||
func (s *traceTestSuite) traceBlock(t *utesting.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
for i, hash := range s.tests.TxHashes {
|
||||
for i, hash := range s.tests.BlockHashes {
|
||||
config := s.tests.TraceConfigs[i]
|
||||
result, err := s.cfg.client.Geth.TraceTransaction(ctx, hash, &config)
|
||||
result, err := s.cfg.client.Geth.TraceBlock(ctx, hash, &config)
|
||||
if err != nil {
|
||||
t.Fatalf("Transaction %d (hash %v): error %v", i, hash, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
defaultBlocksToTrace = 64 // the number of states assumed to be available
|
||||
|
||||
traceGenerateCommand = &cli.Command{
|
||||
Name: "tracegen",
|
||||
Usage: "Generates tests for state tracing",
|
||||
|
|
@ -46,7 +44,8 @@ var (
|
|||
Flags: []cli.Flag{
|
||||
traceTestFileFlag,
|
||||
traceTestResultOutputFlag,
|
||||
traceTestBlockFlag,
|
||||
traceTestStartBlockFlag,
|
||||
traceTestEndBlockFlag,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -58,14 +57,18 @@ var (
|
|||
}
|
||||
traceTestResultOutputFlag = &cli.StringFlag{
|
||||
Name: "trace-output",
|
||||
Usage: "Folder containing the trace output files",
|
||||
Usage: "Folder containing detailed trace output files",
|
||||
Value: "",
|
||||
Category: flags.TestingCategory,
|
||||
}
|
||||
traceTestBlockFlag = &cli.IntFlag{
|
||||
Name: "trace-blocks",
|
||||
Usage: "The number of blocks for tracing",
|
||||
Value: defaultBlocksToTrace,
|
||||
traceTestStartBlockFlag = &cli.IntFlag{
|
||||
Name: "trace-start",
|
||||
Usage: "The number of starting block for tracing (included)",
|
||||
Category: flags.TestingCategory,
|
||||
}
|
||||
traceTestEndBlockFlag = &cli.IntFlag{
|
||||
Name: "trace-end",
|
||||
Usage: "The number of ending block for tracing (excluded)",
|
||||
Category: flags.TestingCategory,
|
||||
}
|
||||
traceTestInvalidOutputFlag = &cli.StringFlag{
|
||||
|
|
@ -81,21 +84,22 @@ func generateTraceTests(clictx *cli.Context) error {
|
|||
client = makeClient(clictx)
|
||||
outputFile = clictx.String(traceTestFileFlag.Name)
|
||||
outputDir = clictx.String(traceTestResultOutputFlag.Name)
|
||||
blocks = clictx.Int(traceTestBlockFlag.Name)
|
||||
startBlock = clictx.Int(traceTestStartBlockFlag.Name)
|
||||
endBlock = clictx.Int(traceTestEndBlockFlag.Name)
|
||||
ctx = context.Background()
|
||||
test = new(traceTest)
|
||||
)
|
||||
if outputDir != "" {
|
||||
err := os.MkdirAll(outputDir, os.ModePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
latest, err := client.Eth.BlockNumber(ctx)
|
||||
if err != nil {
|
||||
exit(err)
|
||||
}
|
||||
if latest < uint64(blocks) {
|
||||
if startBlock > endBlock {
|
||||
exit(fmt.Errorf("invalid block range for tracing, start: %d, end: %d", startBlock, endBlock))
|
||||
}
|
||||
if endBlock-startBlock == 0 {
|
||||
exit(fmt.Errorf("invalid block range for tracing, start: %d, end: %d", startBlock, endBlock))
|
||||
}
|
||||
if latest < uint64(startBlock) || latest < uint64(endBlock) {
|
||||
exit(fmt.Errorf("node seems not synced, latest block is %d", latest))
|
||||
}
|
||||
// Get blocks and assign block info into the test
|
||||
|
|
@ -104,37 +108,35 @@ func generateTraceTests(clictx *cli.Context) error {
|
|||
logged = time.Now()
|
||||
failed int
|
||||
)
|
||||
log.Info("Trace transactions around the chain tip", "head", latest, "blocks", blocks)
|
||||
log.Info("Trace transactions around the chain tip", "head", latest, "start", startBlock, "end", endBlock)
|
||||
|
||||
for i := 0; i < blocks; i++ {
|
||||
number := latest - uint64(i)
|
||||
block, err := client.Eth.BlockByNumber(ctx, big.NewInt(int64(number)))
|
||||
for i := startBlock; i < endBlock; i++ {
|
||||
header, err := client.Eth.HeaderByNumber(ctx, big.NewInt(int64(i)))
|
||||
if err != nil {
|
||||
exit(err)
|
||||
}
|
||||
for _, tx := range block.Transactions() {
|
||||
config, configName := randomTraceOption()
|
||||
result, err := client.Geth.TraceTransaction(ctx, tx.Hash(), config)
|
||||
if err != nil {
|
||||
failed += 1
|
||||
break
|
||||
}
|
||||
blob, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
failed += 1
|
||||
break
|
||||
}
|
||||
test.TxHashes = append(test.TxHashes, tx.Hash())
|
||||
test.TraceConfigs = append(test.TraceConfigs, *config)
|
||||
test.ResultHashes = append(test.ResultHashes, crypto.Keccak256Hash(blob))
|
||||
writeTraceResult(outputDir, tx.Hash(), result, configName)
|
||||
config, configName := randomTraceOption()
|
||||
result, err := client.Geth.TraceBlock(ctx, header.Hash(), config)
|
||||
if err != nil {
|
||||
failed += 1
|
||||
continue
|
||||
}
|
||||
blob, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
failed += 1
|
||||
continue
|
||||
}
|
||||
test.BlockHashes = append(test.BlockHashes, header.Hash())
|
||||
test.TraceConfigs = append(test.TraceConfigs, *config)
|
||||
test.ResultHashes = append(test.ResultHashes, crypto.Keccak256Hash(blob))
|
||||
writeTraceResult(outputDir, header.Hash(), result, configName)
|
||||
|
||||
if time.Since(logged) > time.Second*8 {
|
||||
logged = time.Now()
|
||||
log.Info("Tracing transactions", "executed", len(test.TxHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||
log.Info("Tracing blocks", "executed", len(test.BlockHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||
}
|
||||
}
|
||||
log.Info("Traced transactions", "executed", len(test.TxHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||
log.Info("Traced blocks", "executed", len(test.BlockHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
|
||||
|
||||
// Write output file.
|
||||
writeJSON(outputFile, test)
|
||||
|
|
@ -142,24 +144,15 @@ func generateTraceTests(clictx *cli.Context) error {
|
|||
}
|
||||
|
||||
func randomTraceOption() (*tracers.TraceConfig, string) {
|
||||
x := rand.Intn(11)
|
||||
x := rand.Intn(10)
|
||||
if x == 0 {
|
||||
// struct-logger, with all fields enabled, very heavy
|
||||
return &tracers.TraceConfig{
|
||||
Config: &logger.Config{
|
||||
EnableMemory: true,
|
||||
EnableReturnData: true,
|
||||
},
|
||||
}, "structAll"
|
||||
}
|
||||
if x == 1 {
|
||||
// default options for struct-logger, with stack and storage capture
|
||||
// enabled
|
||||
return &tracers.TraceConfig{
|
||||
Config: &logger.Config{},
|
||||
}, "structDefault"
|
||||
}
|
||||
if x == 2 || x == 3 || x == 4 {
|
||||
if x >= 1 && x <= 3 {
|
||||
// struct-logger with storage capture enabled
|
||||
return &tracers.TraceConfig{
|
||||
Config: &logger.Config{
|
||||
|
|
@ -170,14 +163,18 @@ func randomTraceOption() (*tracers.TraceConfig, string) {
|
|||
// Native tracer
|
||||
loggers := []string{"callTracer", "4byteTracer", "flatCallTracer", "muxTracer", "noopTracer", "prestateTracer"}
|
||||
return &tracers.TraceConfig{
|
||||
Tracer: &loggers[x-5],
|
||||
}, loggers[x-5]
|
||||
Tracer: &loggers[x-4],
|
||||
}, loggers[x-4]
|
||||
}
|
||||
|
||||
func writeTraceResult(dir string, hash common.Hash, result any, configName string) {
|
||||
if dir == "" {
|
||||
return
|
||||
}
|
||||
// Ensure the directory exists
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
exit(fmt.Errorf("failed to create directories: %w", err))
|
||||
}
|
||||
name := filepath.Join(dir, configName+"_"+hash.String())
|
||||
file, err := os.Create(name)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ import (
|
|||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"math/bits"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const uintBits = 32 << (uint64(^uint(0)) >> 63)
|
||||
|
||||
// Errors
|
||||
var (
|
||||
ErrEmptyString = &decError{"empty hex string"}
|
||||
|
|
@ -48,7 +47,7 @@ var (
|
|||
ErrEmptyNumber = &decError{"hex string \"0x\""}
|
||||
ErrLeadingZero = &decError{"hex number with leading zero digits"}
|
||||
ErrUint64Range = &decError{"hex number > 64 bits"}
|
||||
ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)}
|
||||
ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", bits.UintSize)}
|
||||
ErrBig256Range = &decError{"hex number > 256 bits"}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"math/big"
|
||||
"math/bits"
|
||||
"testing"
|
||||
|
||||
"github.com/holiman/uint256"
|
||||
|
|
@ -384,7 +385,7 @@ func TestUnmarshalUint(t *testing.T) {
|
|||
for _, test := range unmarshalUintTests {
|
||||
var v Uint
|
||||
err := json.Unmarshal([]byte(test.input), &v)
|
||||
if uintBits == 32 && test.wantErr32bit != nil {
|
||||
if bits.UintSize == 32 && test.wantErr32bit != nil {
|
||||
checkError(t, test.input, err, test.wantErr32bit)
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/params/forks"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -71,52 +70,82 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
|
|||
parentExcessBlobGas = *parent.ExcessBlobGas
|
||||
parentBlobGasUsed = *parent.BlobGasUsed
|
||||
}
|
||||
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
|
||||
targetGas := uint64(targetBlobsPerBlock(config, headTimestamp)) * params.BlobTxBlobGasPerBlob
|
||||
var (
|
||||
excessBlobGas = parentExcessBlobGas + parentBlobGasUsed
|
||||
target = targetBlobsPerBlock(config, headTimestamp)
|
||||
targetGas = uint64(target) * params.BlobTxBlobGasPerBlob
|
||||
)
|
||||
if excessBlobGas < targetGas {
|
||||
return 0
|
||||
}
|
||||
if !config.IsOsaka(config.LondonBlock, headTimestamp) {
|
||||
// Pre-Osaka, we use the formula defined by EIP-4844.
|
||||
return excessBlobGas - targetGas
|
||||
}
|
||||
|
||||
// EIP-7918 (post-Osaka) introduces a different formula for computing excess.
|
||||
var (
|
||||
baseCost = big.NewInt(params.BlobBaseCost)
|
||||
reservePrice = baseCost.Mul(baseCost, parent.BaseFee)
|
||||
blobPrice = calcBlobPrice(config, parent)
|
||||
)
|
||||
if reservePrice.Cmp(blobPrice) > 0 {
|
||||
max := MaxBlobsPerBlock(config, headTimestamp)
|
||||
scaledExcess := parentBlobGasUsed * uint64(max-target) / uint64(max)
|
||||
return parentExcessBlobGas + scaledExcess
|
||||
}
|
||||
return excessBlobGas - targetGas
|
||||
}
|
||||
|
||||
// CalcBlobFee calculates the blobfee from the header's excess blob gas field.
|
||||
func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int {
|
||||
var frac uint64
|
||||
switch config.LatestFork(header.Time) {
|
||||
case forks.Osaka:
|
||||
frac = config.BlobScheduleConfig.Osaka.UpdateFraction
|
||||
case forks.Prague:
|
||||
frac = config.BlobScheduleConfig.Prague.UpdateFraction
|
||||
case forks.Cancun:
|
||||
frac = config.BlobScheduleConfig.Cancun.UpdateFraction
|
||||
default:
|
||||
blobConfig := latestBlobConfig(config, header.Time)
|
||||
if blobConfig == nil {
|
||||
panic("calculating blob fee on unsupported fork")
|
||||
}
|
||||
return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(frac))
|
||||
return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(blobConfig.UpdateFraction))
|
||||
}
|
||||
|
||||
// MaxBlobsPerBlock returns the max blobs per block for a block at the given timestamp.
|
||||
func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
|
||||
if cfg.BlobScheduleConfig == nil {
|
||||
blobConfig := latestBlobConfig(cfg, time)
|
||||
if blobConfig == nil {
|
||||
return 0
|
||||
}
|
||||
return blobConfig.Max
|
||||
}
|
||||
|
||||
func latestBlobConfig(cfg *params.ChainConfig, time uint64) *params.BlobConfig {
|
||||
if cfg.BlobScheduleConfig == nil {
|
||||
return nil
|
||||
}
|
||||
var (
|
||||
london = cfg.LondonBlock
|
||||
s = cfg.BlobScheduleConfig
|
||||
)
|
||||
switch {
|
||||
case cfg.IsBPO5(london, time) && s.BPO5 != nil:
|
||||
return s.BPO5
|
||||
case cfg.IsBPO4(london, time) && s.BPO4 != nil:
|
||||
return s.BPO4
|
||||
case cfg.IsBPO3(london, time) && s.BPO3 != nil:
|
||||
return s.BPO3
|
||||
case cfg.IsBPO2(london, time) && s.BPO2 != nil:
|
||||
return s.BPO2
|
||||
case cfg.IsBPO1(london, time) && s.BPO1 != nil:
|
||||
return s.BPO1
|
||||
case cfg.IsOsaka(london, time) && s.Osaka != nil:
|
||||
return s.Osaka.Max
|
||||
return s.Osaka
|
||||
case cfg.IsPrague(london, time) && s.Prague != nil:
|
||||
return s.Prague.Max
|
||||
return s.Prague
|
||||
case cfg.IsCancun(london, time) && s.Cancun != nil:
|
||||
return s.Cancun.Max
|
||||
return s.Cancun
|
||||
default:
|
||||
return 0
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MaxBlobsPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp.
|
||||
// MaxBlobGasPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp.
|
||||
func MaxBlobGasPerBlock(cfg *params.ChainConfig, time uint64) uint64 {
|
||||
return uint64(MaxBlobsPerBlock(cfg, time)) * params.BlobTxBlobGasPerBlob
|
||||
}
|
||||
|
|
@ -129,6 +158,16 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
|
|||
return 0
|
||||
}
|
||||
switch {
|
||||
case s.BPO5 != nil:
|
||||
return s.BPO5.Max
|
||||
case s.BPO4 != nil:
|
||||
return s.BPO4.Max
|
||||
case s.BPO3 != nil:
|
||||
return s.BPO3.Max
|
||||
case s.BPO2 != nil:
|
||||
return s.BPO2.Max
|
||||
case s.BPO1 != nil:
|
||||
return s.BPO1.Max
|
||||
case s.Osaka != nil:
|
||||
return s.Osaka.Max
|
||||
case s.Prague != nil:
|
||||
|
|
@ -142,23 +181,11 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
|
|||
|
||||
// targetBlobsPerBlock returns the target number of blobs in a block at the given timestamp.
|
||||
func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
|
||||
if cfg.BlobScheduleConfig == nil {
|
||||
return 0
|
||||
}
|
||||
var (
|
||||
london = cfg.LondonBlock
|
||||
s = cfg.BlobScheduleConfig
|
||||
)
|
||||
switch {
|
||||
case cfg.IsOsaka(london, time) && s.Osaka != nil:
|
||||
return s.Osaka.Target
|
||||
case cfg.IsPrague(london, time) && s.Prague != nil:
|
||||
return s.Prague.Target
|
||||
case cfg.IsCancun(london, time) && s.Cancun != nil:
|
||||
return s.Cancun.Target
|
||||
default:
|
||||
blobConfig := latestBlobConfig(cfg, time)
|
||||
if blobConfig == nil {
|
||||
return 0
|
||||
}
|
||||
return blobConfig.Target
|
||||
}
|
||||
|
||||
// fakeExponential approximates factor * e ** (numerator / denominator) using
|
||||
|
|
@ -177,3 +204,9 @@ func fakeExponential(factor, numerator, denominator *big.Int) *big.Int {
|
|||
}
|
||||
return output.Div(output, denominator)
|
||||
}
|
||||
|
||||
// calcBlobPrice calculates the blob price for a block.
|
||||
func calcBlobPrice(config *params.ChainConfig, header *types.Header) *big.Int {
|
||||
blobBaseFee := CalcBlobFee(config, header)
|
||||
return new(big.Int).Mul(blobBaseFee, big.NewInt(params.BlobTxBlobGasPerBlob))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,3 +127,43 @@ func TestFakeExponential(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCalcExcessBlobGasEIP7918(t *testing.T) {
|
||||
var (
|
||||
cfg = params.MergedTestChainConfig
|
||||
targetBlobs = targetBlobsPerBlock(cfg, *cfg.CancunTime)
|
||||
blobGasTarget = uint64(targetBlobs) * params.BlobTxBlobGasPerBlob
|
||||
)
|
||||
makeHeader := func(parentExcess, parentBaseFee uint64, blobsUsed int) *types.Header {
|
||||
blobGasUsed := uint64(blobsUsed) * params.BlobTxBlobGasPerBlob
|
||||
return &types.Header{
|
||||
BaseFee: big.NewInt(int64(parentBaseFee)),
|
||||
ExcessBlobGas: &parentExcess,
|
||||
BlobGasUsed: &blobGasUsed,
|
||||
}
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
header *types.Header
|
||||
wantExcessGas uint64
|
||||
}{
|
||||
{
|
||||
name: "BelowReservePrice",
|
||||
header: makeHeader(0, 1_000_000_000, targetBlobs),
|
||||
wantExcessGas: blobGasTarget * 3 / 9,
|
||||
},
|
||||
{
|
||||
name: "AboveReservePrice",
|
||||
header: makeHeader(0, 1, targetBlobs),
|
||||
wantExcessGas: 0,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
got := CalcExcessBlobGas(cfg, tc.header, *cfg.CancunTime)
|
||||
if got != tc.wantExcessGas {
|
||||
t.Fatalf("%s: excess-blob-gas mismatch – have %d, want %d",
|
||||
tc.name, got, tc.wantExcessGas)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain) *Bloc
|
|||
// header's transaction and uncle roots. The headers are assumed to be already
|
||||
// validated at this point.
|
||||
func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
||||
// check EIP 7934 RLP-encoded block size cap
|
||||
if v.config.IsOsaka(block.Number(), block.Time()) && block.Size() > params.MaxBlockSize {
|
||||
return ErrBlockOversized
|
||||
}
|
||||
// Check whether the block is already imported.
|
||||
if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) {
|
||||
return ErrKnownBlock
|
||||
|
|
|
|||
|
|
@ -162,10 +162,11 @@ const (
|
|||
// BlockChainConfig contains the configuration of the BlockChain object.
|
||||
type BlockChainConfig struct {
|
||||
// Trie database related options
|
||||
TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory
|
||||
TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk
|
||||
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
|
||||
TrieNoAsyncFlush bool // Whether the asynchronous buffer flushing is disallowed
|
||||
TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory
|
||||
TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk
|
||||
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
|
||||
TrieNoAsyncFlush bool // Whether the asynchronous buffer flushing is disallowed
|
||||
TrieJournalDirectory string // Directory path to the journal used for persisting trie data across node restarts
|
||||
|
||||
Preimages bool // Whether to store preimage of trie key to the disk
|
||||
StateHistory uint64 // Number of blocks from head whose state histories are reserved.
|
||||
|
|
@ -246,6 +247,7 @@ func (cfg *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
|
|||
EnableStateIndexing: cfg.ArchiveMode,
|
||||
TrieCleanSize: cfg.TrieCleanLimit * 1024 * 1024,
|
||||
StateCleanSize: cfg.SnapshotLimit * 1024 * 1024,
|
||||
JournalDirectory: cfg.TrieJournalDirectory,
|
||||
|
||||
// TODO(rjl493456442): The write buffer represents the memory limit used
|
||||
// for flushing both trie data and state data to disk. The config name
|
||||
|
|
@ -314,7 +316,7 @@ type BlockChain struct {
|
|||
|
||||
bodyCache *lru.Cache[common.Hash, *types.Body]
|
||||
bodyRLPCache *lru.Cache[common.Hash, rlp.RawValue]
|
||||
receiptsCache *lru.Cache[common.Hash, []*types.Receipt]
|
||||
receiptsCache *lru.Cache[common.Hash, []*types.Receipt] // Receipts cache with all fields derived
|
||||
blockCache *lru.Cache[common.Hash, *types.Block]
|
||||
|
||||
txLookupLock sync.RWMutex
|
||||
|
|
@ -680,7 +682,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
|
|||
predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()]
|
||||
if predefinedPoint == nil || freezerTail != predefinedPoint.BlockNumber {
|
||||
log.Error("Chain history database is pruned with unknown configuration", "tail", freezerTail)
|
||||
return fmt.Errorf("unexpected database tail")
|
||||
return errors.New("unexpected database tail")
|
||||
}
|
||||
bc.historyPrunePoint.Store(predefinedPoint)
|
||||
return nil
|
||||
|
|
@ -693,15 +695,15 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
|
|||
// action to happen. So just tell them how to do it.
|
||||
log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.cfg.ChainHistoryMode.String()))
|
||||
log.Error(fmt.Sprintf("Run 'geth prune-history' to prune pre-merge history."))
|
||||
return fmt.Errorf("history pruning requested via configuration")
|
||||
return errors.New("history pruning requested via configuration")
|
||||
}
|
||||
predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()]
|
||||
if predefinedPoint == nil {
|
||||
log.Error("Chain history pruning is not supported for this network", "genesis", bc.genesisBlock.Hash())
|
||||
return fmt.Errorf("history pruning requested for unknown network")
|
||||
return errors.New("history pruning requested for unknown network")
|
||||
} else if freezerTail > 0 && freezerTail != predefinedPoint.BlockNumber {
|
||||
log.Error("Chain history database is pruned to unknown block", "tail", freezerTail)
|
||||
return fmt.Errorf("unexpected database tail")
|
||||
return errors.New("unexpected database tail")
|
||||
}
|
||||
bc.historyPrunePoint.Store(predefinedPoint)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -18,9 +18,12 @@ package core
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/state/snapshot"
|
||||
|
|
@ -88,7 +91,10 @@ func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header {
|
|||
|
||||
// GetBlockNumber retrieves the block number associated with a block hash.
|
||||
func (bc *BlockChain) GetBlockNumber(hash common.Hash) *uint64 {
|
||||
return bc.hc.GetBlockNumber(hash)
|
||||
if num, ok := bc.hc.GetBlockNumber(hash); ok {
|
||||
return &num
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetHeadersFrom returns a contiguous segment of headers, in rlp-form, going
|
||||
|
|
@ -104,11 +110,11 @@ func (bc *BlockChain) GetBody(hash common.Hash) *types.Body {
|
|||
if cached, ok := bc.bodyCache.Get(hash); ok {
|
||||
return cached
|
||||
}
|
||||
number := bc.hc.GetBlockNumber(hash)
|
||||
if number == nil {
|
||||
number, ok := bc.hc.GetBlockNumber(hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
body := rawdb.ReadBody(bc.db, hash, *number)
|
||||
body := rawdb.ReadBody(bc.db, hash, number)
|
||||
if body == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -124,11 +130,11 @@ func (bc *BlockChain) GetBodyRLP(hash common.Hash) rlp.RawValue {
|
|||
if cached, ok := bc.bodyRLPCache.Get(hash); ok {
|
||||
return cached
|
||||
}
|
||||
number := bc.hc.GetBlockNumber(hash)
|
||||
if number == nil {
|
||||
number, ok := bc.hc.GetBlockNumber(hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
body := rawdb.ReadBodyRLP(bc.db, hash, *number)
|
||||
body := rawdb.ReadBodyRLP(bc.db, hash, number)
|
||||
if len(body) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -177,11 +183,11 @@ func (bc *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block {
|
|||
|
||||
// GetBlockByHash retrieves a block from the database by hash, caching it if found.
|
||||
func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block {
|
||||
number := bc.hc.GetBlockNumber(hash)
|
||||
if number == nil {
|
||||
number, ok := bc.hc.GetBlockNumber(hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return bc.GetBlock(hash, *number)
|
||||
return bc.GetBlock(hash, number)
|
||||
}
|
||||
|
||||
// GetBlockByNumber retrieves a block from the database by number, caching it
|
||||
|
|
@ -197,36 +203,74 @@ func (bc *BlockChain) GetBlockByNumber(number uint64) *types.Block {
|
|||
// GetBlocksFromHash returns the block corresponding to hash and up to n-1 ancestors.
|
||||
// [deprecated by eth/62]
|
||||
func (bc *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*types.Block) {
|
||||
number := bc.hc.GetBlockNumber(hash)
|
||||
if number == nil {
|
||||
number, ok := bc.hc.GetBlockNumber(hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
block := bc.GetBlock(hash, *number)
|
||||
block := bc.GetBlock(hash, number)
|
||||
if block == nil {
|
||||
break
|
||||
}
|
||||
blocks = append(blocks, block)
|
||||
hash = block.ParentHash()
|
||||
*number--
|
||||
number--
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetCanonicalReceipt allows fetching a receipt for a transaction that was
|
||||
// already looked up on the index. Notably, only receipt in canonical chain
|
||||
// is visible.
|
||||
func (bc *BlockChain) GetCanonicalReceipt(tx *types.Transaction, blockHash common.Hash, blockNumber, txIndex uint64) (*types.Receipt, error) {
|
||||
// The receipt retrieved from the cache contains all previously derived fields
|
||||
if receipts, ok := bc.receiptsCache.Get(blockHash); ok {
|
||||
if int(txIndex) >= len(receipts) {
|
||||
return nil, fmt.Errorf("receipt out of index, length: %d, index: %d", len(receipts), txIndex)
|
||||
}
|
||||
return receipts[int(txIndex)], nil
|
||||
}
|
||||
header := bc.GetHeader(blockHash, blockNumber)
|
||||
if header == nil {
|
||||
return nil, fmt.Errorf("block header is not found, %d, %x", blockNumber, blockHash)
|
||||
}
|
||||
var blobGasPrice *big.Int
|
||||
if header.ExcessBlobGas != nil {
|
||||
blobGasPrice = eip4844.CalcBlobFee(bc.chainConfig, header)
|
||||
}
|
||||
receipt, ctx, err := rawdb.ReadCanonicalRawReceipt(bc.db, blockHash, blockNumber, txIndex)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
signer := types.MakeSigner(bc.chainConfig, new(big.Int).SetUint64(blockNumber), header.Time)
|
||||
receipt.DeriveFields(signer, types.DeriveReceiptContext{
|
||||
BlockHash: blockHash,
|
||||
BlockNumber: blockNumber,
|
||||
BlockTime: header.Time,
|
||||
BaseFee: header.BaseFee,
|
||||
BlobGasPrice: blobGasPrice,
|
||||
GasUsed: ctx.GasUsed,
|
||||
LogIndex: ctx.LogIndex,
|
||||
Tx: tx,
|
||||
TxIndex: uint(txIndex),
|
||||
})
|
||||
return receipt, nil
|
||||
}
|
||||
|
||||
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
|
||||
func (bc *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts {
|
||||
if receipts, ok := bc.receiptsCache.Get(hash); ok {
|
||||
return receipts
|
||||
}
|
||||
number := rawdb.ReadHeaderNumber(bc.db, hash)
|
||||
if number == nil {
|
||||
number, ok := rawdb.ReadHeaderNumber(bc.db, hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
header := bc.GetHeader(hash, *number)
|
||||
header := bc.GetHeader(hash, number)
|
||||
if header == nil {
|
||||
return nil
|
||||
}
|
||||
receipts := rawdb.ReadReceipts(bc.db, hash, *number, header.Time, bc.chainConfig)
|
||||
receipts := rawdb.ReadReceipts(bc.db, hash, number, header.Time, bc.chainConfig)
|
||||
if receipts == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -245,11 +289,11 @@ func (bc *BlockChain) GetRawReceipts(hash common.Hash, number uint64) types.Rece
|
|||
|
||||
// GetReceiptsRLP retrieves the receipts of a block.
|
||||
func (bc *BlockChain) GetReceiptsRLP(hash common.Hash) rlp.RawValue {
|
||||
number := rawdb.ReadHeaderNumber(bc.db, hash)
|
||||
if number == nil {
|
||||
number, ok := rawdb.ReadHeaderNumber(bc.db, hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return rawdb.ReadReceiptsRLP(bc.db, hash, *number)
|
||||
return rawdb.ReadReceiptsRLP(bc.db, hash, number)
|
||||
}
|
||||
|
||||
// GetUnclesInChain retrieves all the uncles from a given block backwards until
|
||||
|
|
@ -277,13 +321,15 @@ func (bc *BlockChain) GetAncestor(hash common.Hash, number, ancestor uint64, max
|
|||
return bc.hc.GetAncestor(hash, number, ancestor, maxNonCanonical)
|
||||
}
|
||||
|
||||
// GetTransactionLookup retrieves the lookup along with the transaction
|
||||
// GetCanonicalTransaction retrieves the lookup along with the transaction
|
||||
// itself associate with the given transaction hash.
|
||||
//
|
||||
// A null will be returned if the transaction is not found. This can be due to
|
||||
// the transaction indexer not being finished. The caller must explicitly check
|
||||
// the indexer progress.
|
||||
func (bc *BlockChain) GetTransactionLookup(hash common.Hash) (*rawdb.LegacyTxLookupEntry, *types.Transaction) {
|
||||
//
|
||||
// Notably, only the transaction in the canonical chain is visible.
|
||||
func (bc *BlockChain) GetCanonicalTransaction(hash common.Hash) (*rawdb.LegacyTxLookupEntry, *types.Transaction) {
|
||||
bc.txLookupLock.RLock()
|
||||
defer bc.txLookupLock.RUnlock()
|
||||
|
||||
|
|
@ -291,7 +337,7 @@ func (bc *BlockChain) GetTransactionLookup(hash common.Hash) (*rawdb.LegacyTxLoo
|
|||
if item, exist := bc.txLookupCache.Get(hash); exist {
|
||||
return item.lookup, item.transaction
|
||||
}
|
||||
tx, blockHash, blockNumber, txIndex := rawdb.ReadTransaction(bc.db, hash)
|
||||
tx, blockHash, blockNumber, txIndex := rawdb.ReadCanonicalTransaction(bc.db, hash)
|
||||
if tx == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ import (
|
|||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/beacon"
|
||||
|
|
@ -46,6 +48,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
"github.com/holiman/uint256"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// So we can deterministically seed different blockchains
|
||||
|
|
@ -779,13 +782,13 @@ func testFastVsFullChains(t *testing.T, scheme string) {
|
|||
}
|
||||
|
||||
// Check that hash-to-number mappings are present in all databases.
|
||||
if m := rawdb.ReadHeaderNumber(fastDb, hash); m == nil || *m != num {
|
||||
if m, ok := rawdb.ReadHeaderNumber(fastDb, hash); !ok || m != num {
|
||||
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in fastdb: %v", num, hash, m)
|
||||
}
|
||||
if m := rawdb.ReadHeaderNumber(ancientDb, hash); m == nil || *m != num {
|
||||
if m, ok := rawdb.ReadHeaderNumber(ancientDb, hash); !ok || m != num {
|
||||
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in ancientdb: %v", num, hash, m)
|
||||
}
|
||||
if m := rawdb.ReadHeaderNumber(archiveDb, hash); m == nil || *m != num {
|
||||
if m, ok := rawdb.ReadHeaderNumber(archiveDb, hash); !ok || m != num {
|
||||
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in archivedb: %v", num, hash, m)
|
||||
}
|
||||
}
|
||||
|
|
@ -1004,29 +1007,47 @@ func testChainTxReorgs(t *testing.T, scheme string) {
|
|||
|
||||
// removed tx
|
||||
for i, tx := range (types.Transactions{pastDrop, freshDrop}) {
|
||||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn != nil {
|
||||
if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
|
||||
t.Errorf("drop %d: tx %v found while shouldn't have been", i, txn)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil {
|
||||
if rcpt, _, _, _ := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil {
|
||||
t.Errorf("drop %d: receipt %v found while shouldn't have been", i, rcpt)
|
||||
}
|
||||
}
|
||||
// added tx
|
||||
for i, tx := range (types.Transactions{pastAdd, freshAdd, futureAdd}) {
|
||||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil {
|
||||
if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
|
||||
t.Errorf("add %d: expected tx to be found", i)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
if rcpt, _, _, index := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
t.Errorf("add %d: expected receipt to be found", i)
|
||||
} else if rawRcpt, ctx, _ := rawdb.ReadCanonicalRawReceipt(db, rcpt.BlockHash, rcpt.BlockNumber.Uint64(), index); rawRcpt == nil {
|
||||
t.Errorf("add %d: expected raw receipt to be found", i)
|
||||
} else {
|
||||
if rcpt.GasUsed != ctx.GasUsed {
|
||||
t.Errorf("add %d, raw gasUsedSoFar doesn't make sense", i)
|
||||
}
|
||||
if len(rcpt.Logs) > 0 && rcpt.Logs[0].Index != ctx.LogIndex {
|
||||
t.Errorf("add %d, raw startingLogIndex doesn't make sense", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
// shared tx
|
||||
for i, tx := range (types.Transactions{postponed, swapped}) {
|
||||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil {
|
||||
if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
|
||||
t.Errorf("share %d: expected tx to be found", i)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
if rcpt, _, _, index := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
t.Errorf("share %d: expected receipt to be found", i)
|
||||
} else if rawRcpt, ctx, _ := rawdb.ReadCanonicalRawReceipt(db, rcpt.BlockHash, rcpt.BlockNumber.Uint64(), index); rawRcpt == nil {
|
||||
t.Errorf("add %d: expected raw receipt to be found", i)
|
||||
} else {
|
||||
if rcpt.GasUsed != ctx.GasUsed {
|
||||
t.Errorf("add %d, raw gasUsedSoFar doesn't make sense", i)
|
||||
}
|
||||
if len(rcpt.Logs) > 0 && rcpt.Logs[0].Index != ctx.LogIndex {
|
||||
t.Errorf("add %d, raw startingLogIndex doesn't make sense", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4404,6 +4425,93 @@ func testInsertChainWithCutoff(t *testing.T, cutoff uint64, ancientLimit uint64,
|
|||
if receipts == nil || len(receipts) != 1 {
|
||||
t.Fatalf("Missed block receipts: %d, cutoff: %d", num, cutoffBlock.NumberU64())
|
||||
}
|
||||
for indx, receipt := range receipts {
|
||||
receiptByLookup, err := chain.GetCanonicalReceipt(body.Transactions[indx], receipt.BlockHash,
|
||||
receipt.BlockNumber.Uint64(), uint64(indx))
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, receipt, receiptByLookup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCanonicalReceipt(t *testing.T) {
|
||||
const chainLength = 64
|
||||
|
||||
// Configure and generate a sample block chain
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
address = crypto.PubkeyToAddress(key.PublicKey)
|
||||
funds = big.NewInt(1000000000000000000)
|
||||
gspec = &Genesis{
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: types.GenesisAlloc{address: {Balance: funds}},
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
}
|
||||
signer = types.LatestSigner(gspec.Config)
|
||||
engine = beacon.New(ethash.NewFaker())
|
||||
codeBin = common.FromHex("0x608060405234801561000f575f5ffd5b507f8ae1c8c6e5f91159d0bc1c4b9a47ce45301753843012cbe641e4456bfc73538b33426040516100419291906100ff565b60405180910390a1610139565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100778261004e565b9050919050565b6100878161006d565b82525050565b5f819050919050565b61009f8161008d565b82525050565b5f82825260208201905092915050565b7f436f6e7374727563746f72207761732063616c6c6564000000000000000000005f82015250565b5f6100e96016836100a5565b91506100f4826100b5565b602082019050919050565b5f6060820190506101125f83018561007e565b61011f6020830184610096565b8181036040830152610130816100dd565b90509392505050565b603e806101455f395ff3fe60806040525f5ffdfea2646970667358221220e8bc3c31e3ac337eab702e8fdfc1c71894f4df1af4221bcde4a2823360f403fb64736f6c634300081e0033")
|
||||
)
|
||||
_, blocks, receipts := GenerateChainWithGenesis(gspec, engine, chainLength, func(i int, block *BlockGen) {
|
||||
// SPDX-License-Identifier: MIT
|
||||
// pragma solidity ^0.8.0;
|
||||
//
|
||||
// contract ConstructorLogger {
|
||||
// event ConstructorLog(address sender, uint256 timestamp, string message);
|
||||
//
|
||||
// constructor() {
|
||||
// emit ConstructorLog(msg.sender, block.timestamp, "Constructor was called");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 608060405234801561000f575f5ffd5b507f8ae1c8c6e5f91159d0bc1c4b9a47ce45301753843012cbe641e4456bfc73538b33426040516100419291906100ff565b60405180910390a1610139565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100778261004e565b9050919050565b6100878161006d565b82525050565b5f819050919050565b61009f8161008d565b82525050565b5f82825260208201905092915050565b7f436f6e7374727563746f72207761732063616c6c6564000000000000000000005f82015250565b5f6100e96016836100a5565b91506100f4826100b5565b602082019050919050565b5f6060820190506101125f83018561007e565b61011f6020830184610096565b8181036040830152610130816100dd565b90509392505050565b603e806101455f395ff3fe60806040525f5ffdfea2646970667358221220e8bc3c31e3ac337eab702e8fdfc1c71894f4df1af4221bcde4a2823360f403fb64736f6c634300081e0033
|
||||
nonce := block.TxNonce(address)
|
||||
tx, err := types.SignTx(types.NewContractCreation(nonce, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
block.AddTx(tx)
|
||||
|
||||
tx2, err := types.SignTx(types.NewContractCreation(nonce+1, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
block.AddTx(tx2)
|
||||
|
||||
tx3, err := types.SignTx(types.NewContractCreation(nonce+2, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
block.AddTx(tx3)
|
||||
})
|
||||
|
||||
db, _ := rawdb.Open(rawdb.NewMemoryDatabase(), rawdb.OpenOptions{})
|
||||
defer db.Close()
|
||||
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||
chain, _ := NewBlockChain(db, gspec, beacon.New(ethash.NewFaker()), options)
|
||||
defer chain.Stop()
|
||||
|
||||
chain.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0)
|
||||
|
||||
for i := 0; i < chainLength; i++ {
|
||||
block := blocks[i]
|
||||
blockReceipts := chain.GetReceiptsByHash(block.Hash())
|
||||
chain.receiptsCache.Purge() // ugly hack
|
||||
for txIndex, tx := range block.Body().Transactions {
|
||||
receipt, err := chain.GetCanonicalReceipt(tx, block.Hash(), block.NumberU64(), uint64(txIndex))
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(receipts[i][txIndex], receipt) {
|
||||
want := spew.Sdump(receipts[i][txIndex])
|
||||
got := spew.Sdump(receipt)
|
||||
t.Fatalf("Receipt is not matched, want %s, got: %s", want, got)
|
||||
}
|
||||
if !reflect.DeepEqual(blockReceipts[txIndex], receipt) {
|
||||
want := spew.Sdump(blockReceipts[txIndex])
|
||||
got := spew.Sdump(receipt)
|
||||
t.Fatalf("Receipt is not matched, want %s, got: %s", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -540,8 +540,10 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
|
|||
return block, b.receipts
|
||||
}
|
||||
|
||||
sdb := state.NewDatabase(trdb, nil)
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
statedb, err := state.New(parent.Root(), state.NewDatabase(trdb, nil))
|
||||
statedb, err := state.New(parent.Root(), sdb)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ var (
|
|||
|
||||
// ErrNoGenesis is returned when there is no Genesis Block.
|
||||
ErrNoGenesis = errors.New("genesis not found in chain")
|
||||
|
||||
// ErrBlockOversized is returned if the size of the RLP-encoded block
|
||||
// exceeds the cap established by EIP 7934
|
||||
ErrBlockOversized = errors.New("block RLP-encoded size exceeds maximum")
|
||||
)
|
||||
|
||||
// List of evm-call-message pre-checking errors. All state transition messages will
|
||||
|
|
@ -114,6 +118,9 @@ var (
|
|||
// ErrMissingBlobHashes is returned if a blob transaction has no blob hashes.
|
||||
ErrMissingBlobHashes = errors.New("blob transaction missing blob hashes")
|
||||
|
||||
// ErrTooManyBlobs is returned if a blob transaction exceeds the maximum number of blobs.
|
||||
ErrTooManyBlobs = errors.New("blob transaction has too many blobs")
|
||||
|
||||
// ErrBlobTxCreate is returned if a blob transaction has no explicit to field.
|
||||
ErrBlobTxCreate = errors.New("blob transaction of type create")
|
||||
|
||||
|
|
@ -122,6 +129,9 @@ var (
|
|||
// Message validation errors:
|
||||
ErrEmptyAuthList = errors.New("EIP-7702 transaction with empty auth list")
|
||||
ErrSetCodeTxCreate = errors.New("EIP-7702 transaction cannot be used to create contract")
|
||||
|
||||
// -- EIP-7825 errors --
|
||||
ErrGasLimitTooHigh = errors.New("transaction gas limit too high")
|
||||
)
|
||||
|
||||
// EIP-7702 state transition errors.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ func NewChainView(chain blockchain, number uint64, hash common.Hash) *ChainView
|
|||
headNumber: number,
|
||||
hashes: []common.Hash{hash},
|
||||
}
|
||||
cv.extendNonCanonical()
|
||||
if !cv.extendNonCanonical() {
|
||||
return nil
|
||||
}
|
||||
return cv
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +131,11 @@ func (cv *ChainView) SharedRange(cv2 *ChainView) common.Range[uint64] {
|
|||
return common.Range[uint64]{}
|
||||
}
|
||||
var sharedLen uint64
|
||||
for n := min(cv.headNumber+1-uint64(len(cv.hashes)), cv2.headNumber+1-uint64(len(cv2.hashes))); n <= cv.headNumber && n <= cv2.headNumber && cv.blockHash(n) == cv2.blockHash(n); n++ {
|
||||
for n := min(cv.headNumber+1-uint64(len(cv.hashes)), cv2.headNumber+1-uint64(len(cv2.hashes))); n <= cv.headNumber && n <= cv2.headNumber; n++ {
|
||||
h1, h2 := cv.blockHash(n), cv2.blockHash(n)
|
||||
if h1 != h2 || h1 == (common.Hash{}) {
|
||||
break
|
||||
}
|
||||
sharedLen = n + 1
|
||||
}
|
||||
return common.NewRange(0, sharedLen)
|
||||
|
|
@ -153,10 +159,13 @@ func matchViews(cv1, cv2 *ChainView, number uint64) bool {
|
|||
if cv1.headNumber < number || cv2.headNumber < number {
|
||||
return false
|
||||
}
|
||||
var h1, h2 common.Hash
|
||||
if number == cv1.headNumber || number == cv2.headNumber {
|
||||
return cv1.BlockId(number) == cv2.BlockId(number)
|
||||
h1, h2 = cv1.BlockId(number), cv2.BlockId(number)
|
||||
} else {
|
||||
h1, h2 = cv1.BlockHash(number), cv2.BlockHash(number)
|
||||
}
|
||||
return cv1.BlockHash(number) == cv2.BlockHash(number)
|
||||
return h1 == h2 && h1 != common.Hash{}
|
||||
}
|
||||
|
||||
// extendNonCanonical checks whether the previously known reverse list of head
|
||||
|
|
@ -175,7 +184,10 @@ func (cv *ChainView) extendNonCanonical() bool {
|
|||
}
|
||||
header := cv.chain.GetHeader(hash, number)
|
||||
if header == nil {
|
||||
log.Error("Header not found", "number", number, "hash", hash)
|
||||
// Header not found - this can happen after debug_setHead operations
|
||||
// where blocks have been deleted. Return false to indicate the chain view
|
||||
// is no longer valid rather than logging repeated errors.
|
||||
log.Debug("Header not found during chain view extension", "number", number, "hash", hash)
|
||||
return false
|
||||
}
|
||||
cv.hashes = append(cv.hashes, header.ParentHash)
|
||||
|
|
|
|||
|
|
@ -18,5 +18,11 @@
|
|||
{"blockNumber": 3221725, "blockId": "0xe771f897dece48b1583cc1d1d10de8015da57407eb1fdf239fdbe46eaab85143", "firstIndex": 1140850137},
|
||||
{"blockNumber": 3357164, "blockId": "0x6252d0aa54c79623b0680069c88d7b5c47983f0d5c4845b6c811b8d9b5e8ff3c", "firstIndex": 1207959453},
|
||||
{"blockNumber": 3447019, "blockId": "0xeb7d585e1e063f3cc05ed399fbf6c2df63c271f62f030acb804e9fb1e74b6dc1", "firstIndex": 1275067542},
|
||||
{"blockNumber": 3546397, "blockId": "0xdabdef7defa4281180a57c5af121877b82274f15ccf074ea0096146f4c246df2", "firstIndex": 1342176778}
|
||||
{"blockNumber": 3546397, "blockId": "0xdabdef7defa4281180a57c5af121877b82274f15ccf074ea0096146f4c246df2", "firstIndex": 1342176778},
|
||||
{"blockNumber": 3867885, "blockId": "0x8be069dd7a3e2ffb869ee164d11b28555233d2510b134ab9d5484fdae55d2225", "firstIndex": 1409285539},
|
||||
{"blockNumber": 3935446, "blockId": "0xc91a61bc215bbcccc3020c62e5c8153162df0d8bcc59813d74671b2d24903ed7", "firstIndex": 1476394742},
|
||||
{"blockNumber": 3989508, "blockId": "0xc85dec36a767e44237842ef51915944c2a49780c8c394a3aa6cfb013c99cf58b", "firstIndex": 1543503452},
|
||||
{"blockNumber": 4057078, "blockId": "0xccdb79f6705629cb6ab1667a1244938f60911236549143fcff23a3989213e67e", "firstIndex": 1610612030},
|
||||
{"blockNumber": 4126499, "blockId": "0x92f2ef21fc911e87e81e38373d5f2915587b9648a0ab3cf4fcfe3e5aaffe7b85", "firstIndex": 1677720416},
|
||||
{"blockNumber": 4239335, "blockId": "0x64fbd22965eb583a584552b7edb9b7ce26fb6aad247c1063d0d5a4d11cbcc58c", "firstIndex": 1744830176}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -267,5 +267,26 @@
|
|||
{"blockNumber": 22168652, "blockId": "0x6ae43618c915e636794e2cc2d75dde9992766881c7405fe6479c045ed4bee57e", "firstIndex": 17850956277},
|
||||
{"blockNumber": 22190975, "blockId": "0x9437121647899a4b7b84d67fbea7cc6ff967481c2eab4328ccd86e2cefe19420", "firstIndex": 17918066140},
|
||||
{"blockNumber": 22234357, "blockId": "0x036030830134f9224160d5a0b62da35ec7813dc8855d554bd22e9d38545243ed", "firstIndex": 17985175075},
|
||||
{"blockNumber": 22276736, "blockId": "0x5ceb96d98aa1b4c1c2f2fa253ae9cdb1b04e0420c11bf795400e8762c0a1635c", "firstIndex": 18052284344}
|
||||
{"blockNumber": 22276736, "blockId": "0x5ceb96d98aa1b4c1c2f2fa253ae9cdb1b04e0420c11bf795400e8762c0a1635c", "firstIndex": 18052284344},
|
||||
{"blockNumber": 22321282, "blockId": "0x8a601ebf6a757020c6d43a978f0bd2c150c4acc1ffdd50c7ee88afc78b0c11f8", "firstIndex": 18119392242},
|
||||
{"blockNumber": 22349231, "blockId": "0xb751c026a92ba5be95ad7ea4e2729a175b0d0e11a4c108f47cab232b4715d1a2", "firstIndex": 18186501218},
|
||||
{"blockNumber": 22377469, "blockId": "0xa47916860a22f7e26761ec2d7f717410791bd3ed0237b2f6266750214c7bbf08", "firstIndex": 18253610249},
|
||||
{"blockNumber": 22422685, "blockId": "0x8beaee39603af55fad222730f556c840c41cd76a5eef0bad367ac94d3b86c7aa", "firstIndex": 18320716377},
|
||||
{"blockNumber": 22462378, "blockId": "0x6dba9c5d2949f5a6a072267b590e8b15e6fb157a0fc22719387f1fd6bfcd8d5d", "firstIndex": 18387828426},
|
||||
{"blockNumber": 22500185, "blockId": "0x2484c380df0a8f7edfdf8d917570d23fab8499aea80c35b6cf4e5fe1e34106e9", "firstIndex": 18454936227},
|
||||
{"blockNumber": 22539624, "blockId": "0xd418071906803d25afc3842a6a6468ad3b5fea27107b314ce4e2ccf08b478acf", "firstIndex": 18522044531},
|
||||
{"blockNumber": 22577021, "blockId": "0xff222982693f3ff60d2097822171f80a6ddd979080aeb7e995bfb1b973497c84", "firstIndex": 18589154438},
|
||||
{"blockNumber": 22614525, "blockId": "0x9868da1fea2ffca3f67e35570f02eb5707b27f6967ea4a109eb4ddbf24566efd", "firstIndex": 18656264174},
|
||||
{"blockNumber": 22652848, "blockId": "0x060a911da11ab0f1dda307f5196e622d23901d198925749e70ab58a439477c5a", "firstIndex": 18723372617},
|
||||
{"blockNumber": 22692432, "blockId": "0x6a937f2c283aba8c778c1f5ef340b225fd820f8a7dfa6f24f5fe541994f32f2d", "firstIndex": 18790480232},
|
||||
{"blockNumber": 22731200, "blockId": "0x00d57a9e7a2dad252436fe9f0382c6a8860d301a9f9ffe6d7ac64c82b95300f8", "firstIndex": 18857590076},
|
||||
{"blockNumber": 22769000, "blockId": "0xa48db20307c19c373ef2d31d85088ea14b8df0450491c31982504c87b04edbc0", "firstIndex": 18924699130},
|
||||
{"blockNumber": 22808126, "blockId": "0x1419c64ff003edca0586f1c8ec3063da5c54c57ff826cfb34bc866cc18949653", "firstIndex": 18991807807},
|
||||
{"blockNumber": 22845231, "blockId": "0x691f87217e61c5d7ae9ad53a44d30e1ab6b1cc3f2b689b9fbf7c38fbacacfe3e", "firstIndex": 19058917062},
|
||||
{"blockNumber": 22884189, "blockId": "0x7f102d44c0ea7803f5b0e1a98a6abf0e8383eb99fb114d6f7b4591753ce8bba3", "firstIndex": 19126024122},
|
||||
{"blockNumber": 22920923, "blockId": "0x04fe6179495016fc3fe56d8ef5311c360a5761a898262173849c3494fdd73d92", "firstIndex": 19193134595},
|
||||
{"blockNumber": 22958100, "blockId": "0xe38e0ff7b0c4065ca42ea577bc32f2566ca46f2ddeedcc4bc1f8fb00e7f26329", "firstIndex": 19260242424},
|
||||
{"blockNumber": 22988600, "blockId": "0x04ca74758b22e0ea54b8c992022ff21c16a2af9c45144c3b0f80de921a7eee82", "firstIndex": 19327351273},
|
||||
{"blockNumber": 23018392, "blockId": "0x61cc979b00bc97b48356f986a5b9ec997d674bc904c2a2e4b0f17de08e50b3bb", "firstIndex": 19394459627},
|
||||
{"blockNumber": 23048524, "blockId": "0x489de15d95739ede4ab15e8b5151d80d4dc85ae10e7be800b1a4723094a678df", "firstIndex": 19461570073}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -68,5 +68,32 @@
|
|||
{"blockNumber": 7911722, "blockId": "0x9a85e48e3135c97c51fc1786f2af0596c802e021b6c53cfca65a129cafcd23ed", "firstIndex": 4496287265},
|
||||
{"blockNumber": 7960147, "blockId": "0xc9359cc76d7090e1c8a031108f0ab7a8935d971efd4325fe53612a1d99562f6f", "firstIndex": 4563402388},
|
||||
{"blockNumber": 8030418, "blockId": "0x21867e68cd8327aed2da2601399d60f7f9e41dca4a4f2f9be982e5a2b9304a88", "firstIndex": 4630511616},
|
||||
{"blockNumber": 8087701, "blockId": "0x0fa8c8d7549cc9a8d308262706fe248efe759f8b63511efb1e7f3926e9af2dcb", "firstIndex": 4697614758}
|
||||
{"blockNumber": 8087701, "blockId": "0x0fa8c8d7549cc9a8d308262706fe248efe759f8b63511efb1e7f3926e9af2dcb", "firstIndex": 4697614758},
|
||||
{"blockNumber": 8149130, "blockId": "0x655ea638fd9e35cc25f4332f260d7bf98f4f6fa9a72e1bff861209f18659e94c", "firstIndex": 4764727744},
|
||||
{"blockNumber": 8208672, "blockId": "0xb5847a670dc3b6181f9e2e40e4218548048366d237a0d12e938b9879bc8cf800", "firstIndex": 4831837882},
|
||||
{"blockNumber": 8271345, "blockId": "0x96797214946f29093883b877ccb0f2a9f771a9a3db3794a642b5dcb781c4d194", "firstIndex": 4898942160},
|
||||
{"blockNumber": 8302858, "blockId": "0x6a5977b3382ca69a9e0412333f97b911c1f69f857d8f31dd0fc930980e24f2fc", "firstIndex": 4966054626},
|
||||
{"blockNumber": 8333618, "blockId": "0x2547294aa23b67c42adbdddfcf424b17a95c4ff0f352a6a2442c529cfb0c892a", "firstIndex": 5033163605},
|
||||
{"blockNumber": 8360582, "blockId": "0xf34f5dceb0ef22e0f782b56c12790472acc675997b9c45075bd4e18a9dacd03c", "firstIndex": 5100273631},
|
||||
{"blockNumber": 8387230, "blockId": "0x0fbea42e87620b5beeb76b67febc173847c54333d7dce9fa2f8f2a3fa9c8c22a", "firstIndex": 5167381673},
|
||||
{"blockNumber": 8414795, "blockId": "0x6c9c000cf5e35da3a7e9e1cd56147c8ce9b43a76d6de945675efd9dc03b628c9", "firstIndex": 5234477010},
|
||||
{"blockNumber": 8444749, "blockId": "0xba85f8c9abaddc34e2113eb49385667ba4b008168ae701f46aa7a7ce78c633a1", "firstIndex": 5301598562},
|
||||
{"blockNumber": 8474551, "blockId": "0x720866a40242f087dd25b6f0dd79224884f435b114a39e60c5669f5c942c78c1", "firstIndex": 5368707262},
|
||||
{"blockNumber": 8501310, "blockId": "0x2b6da233532c701202fb5ac67e005f7d3eb71f88a9fac10c25d24dd11ada05e5", "firstIndex": 5435803858},
|
||||
{"blockNumber": 8526970, "blockId": "0x005f9bbad0a10234129d09894d7fcf04bf1398d326510eedb4195808c282802d", "firstIndex": 5502926509},
|
||||
{"blockNumber": 8550412, "blockId": "0x37c9f3efc9f33cf62f590087c8c9ac70011883f75e648647a6fd0fec00ca627c", "firstIndex": 5570034950},
|
||||
{"blockNumber": 8573540, "blockId": "0x81cfb46a07be7c70bb8a0f76b03a4cd502f92032bea68ad7ba10e26351673000", "firstIndex": 5637137662},
|
||||
{"blockNumber": 8590416, "blockId": "0x5c223d58ef22d7b0dd8c498e8498da4787b5dc706681c2bc83849441f5d0922d", "firstIndex": 5704252906},
|
||||
{"blockNumber": 8616793, "blockId": "0x9043ce02742fb5ec43a696602867b7ce6003a95b36cd28a37eeb9785a46ad49f", "firstIndex": 5771357264},
|
||||
{"blockNumber": 8647290, "blockId": "0xd90115193764b0a33f3f2a719381b3ddbce2532607c72fb287a864eb391eeada", "firstIndex": 5838466144},
|
||||
{"blockNumber": 8673192, "blockId": "0x9bc92d340cccaf4c8c03372efc24eb92c5159106729de8d2e9e064f5568d082b", "firstIndex": 5905577457},
|
||||
{"blockNumber": 8700694, "blockId": "0xb3d656a173b962bc6825198e94a4974289db06a8998060bd0f5ee2044a7a7deb", "firstIndex": 5972679345},
|
||||
{"blockNumber": 8724533, "blockId": "0x253ffc6d77b88fe18736e4c313e9930341c444bc87b2ee22b26cfe8d9d0b178d", "firstIndex": 6039795829},
|
||||
{"blockNumber": 8743948, "blockId": "0x04eb66d0261705d31e629193148d0685058d7759ba5f95d2d38e412dbadb8256", "firstIndex": 6106901747},
|
||||
{"blockNumber": 8758378, "blockId": "0x64adf54e662d11db716610157da672c3d8b45f001dbce40a269871b86a84d026", "firstIndex": 6174011544},
|
||||
{"blockNumber": 8777722, "blockId": "0x0a7f9a956024b404c915e70b42221aa027b2dd715b0697f099dccefae0b9af97", "firstIndex": 6241124215},
|
||||
{"blockNumber": 8800154, "blockId": "0x411f90dc18f2bca31fa63615c2866c907bbac1fae8c06782cabfaf788efba665", "firstIndex": 6308233216},
|
||||
{"blockNumber": 8829725, "blockId": "0x5686f3a5eec1b070d0113c588f8f4a560d57ad96b8045cedb5c08bbadaa0273e", "firstIndex": 6375340033},
|
||||
{"blockNumber": 8858036, "blockId": "0x4f9b5d9fac9c6f6e2224f613cda12e8ab95d636774ce87489dce8a9f805ee2e5", "firstIndex": 6442450330},
|
||||
{"blockNumber": 8884811, "blockId": "0x9cf74f978872683802c065e72b5a5326fdad95f19733c34d927b575cd85fd0bd", "firstIndex": 6509559380}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -185,11 +185,14 @@ type filterMapsRange struct {
|
|||
initialized bool
|
||||
headIndexed bool
|
||||
headDelimiter uint64 // zero if headIndexed is false
|
||||
|
||||
// if initialized then all maps are rendered in the maps range
|
||||
maps common.Range[uint32]
|
||||
|
||||
// if tailPartialEpoch > 0 then maps between firstRenderedMap-mapsPerEpoch and
|
||||
// firstRenderedMap-mapsPerEpoch+tailPartialEpoch-1 are rendered
|
||||
tailPartialEpoch uint32
|
||||
|
||||
// if initialized then all log values in the blocks range are fully
|
||||
// rendered
|
||||
// blockLvPointers are available in the blocks range
|
||||
|
|
@ -223,13 +226,15 @@ type Config struct {
|
|||
}
|
||||
|
||||
// NewFilterMaps creates a new FilterMaps and starts the indexer.
|
||||
func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, finalBlock uint64, params Params, config Config) *FilterMaps {
|
||||
func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, finalBlock uint64, params Params, config Config) (*FilterMaps, error) {
|
||||
rs, initialized, err := rawdb.ReadFilterMapsRange(db)
|
||||
if err != nil || (initialized && rs.Version != databaseVersion) {
|
||||
rs, initialized = rawdb.FilterMapsRange{}, false
|
||||
log.Warn("Invalid log index database version; resetting log index")
|
||||
}
|
||||
params.deriveFields()
|
||||
if err := params.sanitize(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
f := &FilterMaps{
|
||||
db: db,
|
||||
closeCh: make(chan struct{}),
|
||||
|
|
@ -254,25 +259,24 @@ func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, f
|
|||
},
|
||||
// deleting last unindexed epoch might have been interrupted by shutdown
|
||||
cleanedEpochsBefore: max(rs.MapsFirst>>params.logMapsPerEpoch, 1) - 1,
|
||||
|
||||
historyCutoff: historyCutoff,
|
||||
finalBlock: finalBlock,
|
||||
matcherSyncCh: make(chan *FilterMapsMatcherBackend),
|
||||
matchers: make(map[*FilterMapsMatcherBackend]struct{}),
|
||||
filterMapCache: lru.NewCache[uint32, filterMap](cachedFilterMaps),
|
||||
lastBlockCache: lru.NewCache[uint32, lastBlockOfMap](cachedLastBlocks),
|
||||
lvPointerCache: lru.NewCache[uint64, uint64](cachedLvPointers),
|
||||
renderSnapshots: lru.NewCache[uint64, *renderedMap](cachedRenderSnapshots),
|
||||
historyCutoff: historyCutoff,
|
||||
finalBlock: finalBlock,
|
||||
matcherSyncCh: make(chan *FilterMapsMatcherBackend),
|
||||
matchers: make(map[*FilterMapsMatcherBackend]struct{}),
|
||||
filterMapCache: lru.NewCache[uint32, filterMap](cachedFilterMaps),
|
||||
lastBlockCache: lru.NewCache[uint32, lastBlockOfMap](cachedLastBlocks),
|
||||
lvPointerCache: lru.NewCache[uint64, uint64](cachedLvPointers),
|
||||
renderSnapshots: lru.NewCache[uint64, *renderedMap](cachedRenderSnapshots),
|
||||
}
|
||||
f.checkRevertRange() // revert maps that are inconsistent with the current chain view
|
||||
|
||||
if f.indexedRange.hasIndexedBlocks() {
|
||||
log.Info("Initialized log indexer",
|
||||
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
|
||||
"first map", f.indexedRange.maps.First(), "last map", f.indexedRange.maps.Last(),
|
||||
"head indexed", f.indexedRange.headIndexed)
|
||||
"firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
|
||||
"firstmap", f.indexedRange.maps.First(), "lastmap", f.indexedRange.maps.Last(),
|
||||
"headindexed", f.indexedRange.headIndexed)
|
||||
}
|
||||
return f
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// Start starts the indexer.
|
||||
|
|
@ -399,7 +403,7 @@ func (f *FilterMaps) init() error {
|
|||
batch := f.db.NewBatch()
|
||||
for epoch := range bestLen {
|
||||
cp := checkpoints[bestIdx][epoch]
|
||||
f.storeLastBlockOfMap(batch, (uint32(epoch+1)<<f.logMapsPerEpoch)-1, cp.BlockNumber, cp.BlockId)
|
||||
f.storeLastBlockOfMap(batch, f.lastEpochMap(uint32(epoch)), cp.BlockNumber, cp.BlockId)
|
||||
f.storeBlockLvPointer(batch, cp.BlockNumber, cp.FirstIndex)
|
||||
}
|
||||
fmr := filterMapsRange{
|
||||
|
|
@ -408,7 +412,7 @@ func (f *FilterMaps) init() error {
|
|||
if bestLen > 0 {
|
||||
cp := checkpoints[bestIdx][bestLen-1]
|
||||
fmr.blocks = common.NewRange(cp.BlockNumber+1, 0)
|
||||
fmr.maps = common.NewRange(uint32(bestLen)<<f.logMapsPerEpoch, 0)
|
||||
fmr.maps = common.NewRange(f.firstEpochMap(uint32(bestLen)), 0)
|
||||
}
|
||||
f.setRange(batch, f.targetView, fmr, false)
|
||||
return batch.Write()
|
||||
|
|
@ -578,9 +582,11 @@ func (f *FilterMaps) getFilterMapRows(mapIndices []uint32, rowIndex uint32, base
|
|||
rows := make([]FilterRow, len(mapIndices))
|
||||
var ptr int
|
||||
for len(mapIndices) > ptr {
|
||||
baseRowGroup := mapIndices[ptr] / f.baseRowGroupLength
|
||||
groupLength := 1
|
||||
for ptr+groupLength < len(mapIndices) && mapIndices[ptr+groupLength]/f.baseRowGroupLength == baseRowGroup {
|
||||
var (
|
||||
groupIndex = f.mapGroupIndex(mapIndices[ptr])
|
||||
groupLength = 1
|
||||
)
|
||||
for ptr+groupLength < len(mapIndices) && f.mapGroupIndex(mapIndices[ptr+groupLength]) == groupIndex {
|
||||
groupLength++
|
||||
}
|
||||
if err := f.getFilterMapRowsOfGroup(rows[ptr:ptr+groupLength], mapIndices[ptr:ptr+groupLength], rowIndex, baseLayerOnly); err != nil {
|
||||
|
|
@ -594,17 +600,19 @@ func (f *FilterMaps) getFilterMapRows(mapIndices []uint32, rowIndex uint32, base
|
|||
// getFilterMapRowsOfGroup fetches a set of filter map rows at map indices
|
||||
// belonging to the same base row group.
|
||||
func (f *FilterMaps) getFilterMapRowsOfGroup(target []FilterRow, mapIndices []uint32, rowIndex uint32, baseLayerOnly bool) error {
|
||||
baseRowGroup := mapIndices[0] / f.baseRowGroupLength
|
||||
baseMapRowIndex := f.mapRowIndex(baseRowGroup*f.baseRowGroupLength, rowIndex)
|
||||
baseRows, err := rawdb.ReadFilterMapBaseRows(f.db, baseMapRowIndex, f.baseRowGroupLength, f.logMapWidth)
|
||||
var (
|
||||
groupIndex = f.mapGroupIndex(mapIndices[0])
|
||||
mapRowIndex = f.mapRowIndex(groupIndex, rowIndex)
|
||||
)
|
||||
baseRows, err := rawdb.ReadFilterMapBaseRows(f.db, mapRowIndex, f.baseRowGroupSize, f.logMapWidth)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to retrieve base row group %d of row %d: %v", baseRowGroup, rowIndex, err)
|
||||
return fmt.Errorf("failed to retrieve base row group %d of row %d: %v", groupIndex, rowIndex, err)
|
||||
}
|
||||
for i, mapIndex := range mapIndices {
|
||||
if mapIndex/f.baseRowGroupLength != baseRowGroup {
|
||||
panic("mapIndices are not in the same base row group")
|
||||
if f.mapGroupIndex(mapIndex) != groupIndex {
|
||||
return fmt.Errorf("maps are not in the same base row group, index: %d, group: %d", mapIndex, groupIndex)
|
||||
}
|
||||
row := baseRows[mapIndex&(f.baseRowGroupLength-1)]
|
||||
row := baseRows[f.mapGroupOffset(mapIndex)]
|
||||
if !baseLayerOnly {
|
||||
extRow, err := rawdb.ReadFilterMapExtRow(f.db, f.mapRowIndex(mapIndex, rowIndex), f.logMapWidth)
|
||||
if err != nil {
|
||||
|
|
@ -621,15 +629,17 @@ func (f *FilterMaps) getFilterMapRowsOfGroup(target []FilterRow, mapIndices []ui
|
|||
// indices and a shared row index.
|
||||
func (f *FilterMaps) storeFilterMapRows(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error {
|
||||
for len(mapIndices) > 0 {
|
||||
baseRowGroup := mapIndices[0] / f.baseRowGroupLength
|
||||
groupLength := 1
|
||||
for groupLength < len(mapIndices) && mapIndices[groupLength]/f.baseRowGroupLength == baseRowGroup {
|
||||
groupLength++
|
||||
var (
|
||||
pos = 1
|
||||
groupIndex = f.mapGroupIndex(mapIndices[0])
|
||||
)
|
||||
for pos < len(mapIndices) && f.mapGroupIndex(mapIndices[pos]) == groupIndex {
|
||||
pos++
|
||||
}
|
||||
if err := f.storeFilterMapRowsOfGroup(batch, mapIndices[:groupLength], rowIndex, rows[:groupLength]); err != nil {
|
||||
if err := f.storeFilterMapRowsOfGroup(batch, mapIndices[:pos], rowIndex, rows[:pos]); err != nil {
|
||||
return err
|
||||
}
|
||||
mapIndices, rows = mapIndices[groupLength:], rows[groupLength:]
|
||||
mapIndices, rows = mapIndices[pos:], rows[pos:]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -637,21 +647,23 @@ func (f *FilterMaps) storeFilterMapRows(batch ethdb.Batch, mapIndices []uint32,
|
|||
// storeFilterMapRowsOfGroup stores a set of filter map rows at map indices
|
||||
// belonging to the same base row group.
|
||||
func (f *FilterMaps) storeFilterMapRowsOfGroup(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error {
|
||||
baseRowGroup := mapIndices[0] / f.baseRowGroupLength
|
||||
baseMapRowIndex := f.mapRowIndex(baseRowGroup*f.baseRowGroupLength, rowIndex)
|
||||
var baseRows [][]uint32
|
||||
if uint32(len(mapIndices)) != f.baseRowGroupLength { // skip base rows read if all rows are replaced
|
||||
var (
|
||||
baseRows [][]uint32
|
||||
groupIndex = f.mapGroupIndex(mapIndices[0])
|
||||
mapRowIndex = f.mapRowIndex(groupIndex, rowIndex)
|
||||
)
|
||||
if uint32(len(mapIndices)) != f.baseRowGroupSize { // skip base rows read if all rows are replaced
|
||||
var err error
|
||||
baseRows, err = rawdb.ReadFilterMapBaseRows(f.db, baseMapRowIndex, f.baseRowGroupLength, f.logMapWidth)
|
||||
baseRows, err = rawdb.ReadFilterMapBaseRows(f.db, mapRowIndex, f.baseRowGroupSize, f.logMapWidth)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to retrieve base row group %d of row %d for modification: %v", baseRowGroup, rowIndex, err)
|
||||
return fmt.Errorf("failed to retrieve filter map %d base rows %d for modification: %v", groupIndex, rowIndex, err)
|
||||
}
|
||||
} else {
|
||||
baseRows = make([][]uint32, f.baseRowGroupLength)
|
||||
baseRows = make([][]uint32, f.baseRowGroupSize)
|
||||
}
|
||||
for i, mapIndex := range mapIndices {
|
||||
if mapIndex/f.baseRowGroupLength != baseRowGroup {
|
||||
panic("mapIndices are not in the same base row group")
|
||||
if f.mapGroupIndex(mapIndex) != groupIndex {
|
||||
return fmt.Errorf("maps are not in the same base row group, index: %d, group: %d", mapIndex, groupIndex)
|
||||
}
|
||||
baseRow := []uint32(rows[i])
|
||||
var extRow FilterRow
|
||||
|
|
@ -659,10 +671,10 @@ func (f *FilterMaps) storeFilterMapRowsOfGroup(batch ethdb.Batch, mapIndices []u
|
|||
extRow = baseRow[f.baseRowLength:]
|
||||
baseRow = baseRow[:f.baseRowLength]
|
||||
}
|
||||
baseRows[mapIndex&(f.baseRowGroupLength-1)] = baseRow
|
||||
baseRows[f.mapGroupOffset(mapIndex)] = baseRow
|
||||
rawdb.WriteFilterMapExtRow(batch, f.mapRowIndex(mapIndex, rowIndex), extRow, f.logMapWidth)
|
||||
}
|
||||
rawdb.WriteFilterMapBaseRows(batch, baseMapRowIndex, baseRows, f.logMapWidth)
|
||||
rawdb.WriteFilterMapBaseRows(batch, mapRowIndex, baseRows, f.logMapWidth)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -747,12 +759,12 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
|
|||
defer f.indexLock.Unlock()
|
||||
|
||||
// determine epoch boundaries
|
||||
firstMap := epoch << f.logMapsPerEpoch
|
||||
lastBlock, _, err := f.getLastBlockOfMap(firstMap + f.mapsPerEpoch - 1)
|
||||
lastBlock, _, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to retrieve last block of deleted epoch %d: %v", epoch, err)
|
||||
}
|
||||
var firstBlock uint64
|
||||
firstMap := f.firstEpochMap(epoch)
|
||||
if epoch > 0 {
|
||||
firstBlock, _, err = f.getLastBlockOfMap(firstMap - 1)
|
||||
if err != nil {
|
||||
|
|
@ -763,8 +775,8 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
|
|||
// update rendered range if necessary
|
||||
var (
|
||||
fmr = f.indexedRange
|
||||
firstEpoch = f.indexedRange.maps.First() >> f.logMapsPerEpoch
|
||||
afterLastEpoch = (f.indexedRange.maps.AfterLast() + f.mapsPerEpoch - 1) >> f.logMapsPerEpoch
|
||||
firstEpoch = f.mapEpoch(f.indexedRange.maps.First())
|
||||
afterLastEpoch = f.mapEpoch(f.indexedRange.maps.AfterLast() + f.mapsPerEpoch - 1)
|
||||
)
|
||||
if f.indexedRange.tailPartialEpoch != 0 && firstEpoch > 0 {
|
||||
firstEpoch--
|
||||
|
|
@ -776,7 +788,7 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
|
|||
// first fully or partially rendered epoch and there is at least one
|
||||
// rendered map in the next epoch; remove from indexed range
|
||||
fmr.tailPartialEpoch = 0
|
||||
fmr.maps.SetFirst((epoch + 1) << f.logMapsPerEpoch)
|
||||
fmr.maps.SetFirst(f.firstEpochMap(epoch + 1))
|
||||
fmr.blocks.SetFirst(lastBlock + 1)
|
||||
f.setRange(f.db, f.indexedView, fmr, false)
|
||||
default:
|
||||
|
|
@ -857,7 +869,7 @@ func (f *FilterMaps) exportCheckpoints() {
|
|||
w.WriteString("[\n")
|
||||
comma := ","
|
||||
for epoch := uint32(0); epoch < epochCount; epoch++ {
|
||||
lastBlock, lastBlockId, err := f.getLastBlockOfMap((epoch+1)<<f.logMapsPerEpoch - 1)
|
||||
lastBlock, lastBlockId, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
|
||||
if err != nil {
|
||||
log.Error("Error fetching last block of epoch", "epoch", epoch, "error", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ func (f *FilterMaps) tryIndexHead() error {
|
|||
// is changed.
|
||||
func (f *FilterMaps) tryIndexTail() (bool, error) {
|
||||
for {
|
||||
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch
|
||||
firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
|
||||
if firstEpoch == 0 || !f.needTailEpoch(firstEpoch-1) {
|
||||
break
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ func (f *FilterMaps) tryIndexTail() (bool, error) {
|
|||
// Note that unindexing is very quick as it only removes continuous ranges of
|
||||
// data from the database and is also called while running head indexing.
|
||||
func (f *FilterMaps) tryUnindexTail() (bool, error) {
|
||||
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch
|
||||
firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
|
||||
if f.indexedRange.tailPartialEpoch > 0 && firstEpoch > 0 {
|
||||
firstEpoch--
|
||||
}
|
||||
|
|
@ -380,9 +380,9 @@ func (f *FilterMaps) tryUnindexTail() (bool, error) {
|
|||
}
|
||||
if f.startedTailUnindex && f.indexedRange.hasIndexedBlocks() {
|
||||
log.Info("Log index tail unindexing finished",
|
||||
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
|
||||
"removed maps", f.indexedRange.maps.First()-f.ptrTailUnindexMap,
|
||||
"removed blocks", f.indexedRange.blocks.First()-f.tailPartialBlocks()-f.ptrTailUnindexBlock,
|
||||
"firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
|
||||
"removedmaps", f.indexedRange.maps.First()-f.ptrTailUnindexMap,
|
||||
"removedblocks", f.indexedRange.blocks.First()-f.tailPartialBlocks()-f.ptrTailUnindexBlock,
|
||||
"elapsed", common.PrettyDuration(time.Since(f.startedTailUnindexAt)))
|
||||
f.startedTailUnindex = false
|
||||
}
|
||||
|
|
@ -392,11 +392,11 @@ func (f *FilterMaps) tryUnindexTail() (bool, error) {
|
|||
// needTailEpoch returns true if the given tail epoch needs to be kept
|
||||
// according to the current tail target, false if it can be removed.
|
||||
func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
|
||||
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch
|
||||
firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
|
||||
if epoch > firstEpoch {
|
||||
return true
|
||||
}
|
||||
if (epoch+1)<<f.logMapsPerEpoch >= f.indexedRange.maps.AfterLast() {
|
||||
if f.firstEpochMap(epoch+1) >= f.indexedRange.maps.AfterLast() {
|
||||
return true
|
||||
}
|
||||
if epoch+1 < firstEpoch {
|
||||
|
|
@ -405,7 +405,7 @@ func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
|
|||
var lastBlockOfPrevEpoch uint64
|
||||
if epoch > 0 {
|
||||
var err error
|
||||
lastBlockOfPrevEpoch, _, err = f.getLastBlockOfMap(epoch<<f.logMapsPerEpoch - 1)
|
||||
lastBlockOfPrevEpoch, _, err = f.getLastBlockOfMap(f.lastEpochMap(epoch - 1))
|
||||
if err != nil {
|
||||
log.Error("Could not get last block of previous epoch", "epoch", epoch-1, "error", err)
|
||||
return epoch >= firstEpoch
|
||||
|
|
@ -414,7 +414,7 @@ func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
|
|||
if f.historyCutoff > lastBlockOfPrevEpoch {
|
||||
return false
|
||||
}
|
||||
lastBlockOfEpoch, _, err := f.getLastBlockOfMap((epoch+1)<<f.logMapsPerEpoch - 1)
|
||||
lastBlockOfEpoch, _, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
|
||||
if err != nil {
|
||||
log.Error("Could not get last block of epoch", "epoch", epoch, "error", err)
|
||||
return epoch >= firstEpoch
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ var testParams = Params{
|
|||
logMapWidth: 24,
|
||||
logMapsPerEpoch: 4,
|
||||
logValuesPerMap: 4,
|
||||
baseRowGroupLength: 4,
|
||||
baseRowGroupSize: 4,
|
||||
baseRowLengthRatio: 2,
|
||||
logLayerDiff: 2,
|
||||
}
|
||||
|
|
@ -370,7 +370,7 @@ func (ts *testSetup) setHistory(history uint64, noHistory bool) {
|
|||
History: history,
|
||||
Disabled: noHistory,
|
||||
}
|
||||
ts.fm = NewFilterMaps(ts.db, view, 0, 0, ts.params, config)
|
||||
ts.fm, _ = NewFilterMaps(ts.db, view, 0, 0, ts.params, config)
|
||||
ts.fm.testDisableSnapshots = ts.testDisableSnapshots
|
||||
ts.fm.Start()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ func (r *mapRenderer) run(stopCb func() bool, writeCb func()) (bool, error) {
|
|||
// map finished
|
||||
r.finishedMaps[r.currentMap.mapIndex] = r.currentMap
|
||||
r.finished.SetLast(r.finished.AfterLast())
|
||||
if len(r.finishedMaps) >= maxMapsPerBatch || r.finished.AfterLast()&(r.f.baseRowGroupLength-1) == 0 {
|
||||
if len(r.finishedMaps) >= maxMapsPerBatch || r.f.mapGroupOffset(r.finished.AfterLast()) == 0 {
|
||||
if err := r.writeFinishedMaps(stopCb); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ func (m *matchSequenceInstance) dropNext(mapIndex uint32) bool {
|
|||
// results at mapIndex and mapIndex+1. Note that acquiring nextNextRes may be
|
||||
// skipped and it can be substituted with an empty list if baseRes has no potential
|
||||
// matches that could be sequence matched with anything that could be in nextNextRes.
|
||||
func (params *Params) matchResults(mapIndex uint32, offset uint64, baseRes, nextRes potentialMatches) potentialMatches {
|
||||
func (p *Params) matchResults(mapIndex uint32, offset uint64, baseRes, nextRes potentialMatches) potentialMatches {
|
||||
if nextRes == nil || (baseRes != nil && len(baseRes) == 0) {
|
||||
// if nextRes is a wild card or baseRes is empty then the sequence matcher
|
||||
// result equals baseRes.
|
||||
|
|
@ -854,7 +854,7 @@ func (params *Params) matchResults(mapIndex uint32, offset uint64, baseRes, next
|
|||
// if baseRes is a wild card or nextRes is empty then the sequence matcher
|
||||
// result is the items of nextRes with a negative offset applied.
|
||||
result := make(potentialMatches, 0, len(nextRes))
|
||||
min := (uint64(mapIndex) << params.logValuesPerMap) + offset
|
||||
min := (uint64(mapIndex) << p.logValuesPerMap) + offset
|
||||
for _, v := range nextRes {
|
||||
if v >= min {
|
||||
result = append(result, v-offset)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package filtermaps
|
|||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"math"
|
||||
"sort"
|
||||
|
|
@ -28,19 +29,36 @@ import (
|
|||
|
||||
// Params defines the basic parameters of the log index structure.
|
||||
type Params struct {
|
||||
logMapHeight uint // log2(mapHeight)
|
||||
logMapWidth uint // log2(mapWidth)
|
||||
logMapsPerEpoch uint // log2(mapsPerEpoch)
|
||||
logValuesPerMap uint // log2(logValuesPerMap)
|
||||
baseRowLengthRatio uint // baseRowLength / average row length
|
||||
logLayerDiff uint // maxRowLength log2 growth per layer
|
||||
// derived fields
|
||||
mapHeight uint32 // filter map height (number of rows)
|
||||
mapsPerEpoch uint32 // number of maps in an epoch
|
||||
logMapHeight uint // The number of bits required to represent the map height
|
||||
logMapWidth uint // The number of bits required to represent the map width
|
||||
logMapsPerEpoch uint // The number of bits required to represent the number of maps per epoch
|
||||
logValuesPerMap uint // The number of bits required to represent the number of log values per map
|
||||
|
||||
// baseRowLengthRatio represents the ratio of base row length
|
||||
// to the average row length.
|
||||
baseRowLengthRatio uint
|
||||
|
||||
// logLayerDiff defines the logarithmic growth factor (base 2) of
|
||||
// the maximum row length per layer. It indicates how much the maximum
|
||||
// row length increases as the layer depth increases.
|
||||
//
|
||||
// Specifically:
|
||||
// - the row length in base layer (layer == 0) is baseRowLength
|
||||
// - the row length in layer x is baseRowLength << (logLayerDiff * x)
|
||||
logLayerDiff uint
|
||||
|
||||
// These fields can be derived with the information above
|
||||
mapHeight uint32 // The number of rows in the filter map
|
||||
mapsPerEpoch uint32 // The number of maps in an epoch
|
||||
valuesPerMap uint64 // The number of log values marked on each filter map
|
||||
baseRowLength uint32 // maximum number of log values per row on layer 0
|
||||
valuesPerMap uint64 // number of log values marked on each filter map
|
||||
// not affecting consensus
|
||||
baseRowGroupLength uint32 // length of base row groups in local database
|
||||
|
||||
// baseRowGroupSize defines the number of base row entries grouped together
|
||||
// as a single database entry in the local database to optimize storage
|
||||
// and retrieval efficiency.
|
||||
//
|
||||
// This value can be configured based on the specific implementation.
|
||||
baseRowGroupSize uint32
|
||||
}
|
||||
|
||||
// DefaultParams is the set of parameters used on mainnet.
|
||||
|
|
@ -49,7 +67,7 @@ var DefaultParams = Params{
|
|||
logMapWidth: 24,
|
||||
logMapsPerEpoch: 10,
|
||||
logValuesPerMap: 16,
|
||||
baseRowGroupLength: 32,
|
||||
baseRowGroupSize: 32,
|
||||
baseRowLengthRatio: 8,
|
||||
logLayerDiff: 4,
|
||||
}
|
||||
|
|
@ -60,7 +78,7 @@ var RangeTestParams = Params{
|
|||
logMapWidth: 24,
|
||||
logMapsPerEpoch: 0,
|
||||
logValuesPerMap: 0,
|
||||
baseRowGroupLength: 32,
|
||||
baseRowGroupSize: 32,
|
||||
baseRowLengthRatio: 16, // baseRowLength >= 1
|
||||
logLayerDiff: 4,
|
||||
}
|
||||
|
|
@ -91,6 +109,44 @@ func topicValue(topic common.Hash) common.Hash {
|
|||
return result
|
||||
}
|
||||
|
||||
// sanitize derives any missing fields and validates the parameter values.
|
||||
func (p *Params) sanitize() error {
|
||||
p.deriveFields()
|
||||
if p.logMapWidth%8 != 0 {
|
||||
return fmt.Errorf("invalid configuration: logMapWidth (%d) must be a multiple of 8", p.logMapWidth)
|
||||
}
|
||||
if p.baseRowGroupSize == 0 || (p.baseRowGroupSize&(p.baseRowGroupSize-1)) != 0 {
|
||||
return fmt.Errorf("invalid configuration: baseRowGroupSize (%d) must be a power of 2", p.baseRowGroupSize)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// mapGroupIndex returns the start index of the base row group that contains the
|
||||
// given map index. Assumes baseRowGroupSize is a power of 2.
|
||||
func (p *Params) mapGroupIndex(index uint32) uint32 {
|
||||
return index & ^(p.baseRowGroupSize - 1)
|
||||
}
|
||||
|
||||
// mapGroupOffset returns the offset of the given map index within its base row group.
|
||||
func (p *Params) mapGroupOffset(index uint32) uint32 {
|
||||
return index & (p.baseRowGroupSize - 1)
|
||||
}
|
||||
|
||||
// mapEpoch returns the epoch number that the given map index belongs to.
|
||||
func (p *Params) mapEpoch(index uint32) uint32 {
|
||||
return index >> p.logMapsPerEpoch
|
||||
}
|
||||
|
||||
// firstEpochMap returns the index of the first map in the specified epoch.
|
||||
func (p *Params) firstEpochMap(epoch uint32) uint32 {
|
||||
return epoch << p.logMapsPerEpoch
|
||||
}
|
||||
|
||||
// lastEpochMap returns the index of the last map in the specified epoch.
|
||||
func (p *Params) lastEpochMap(epoch uint32) uint32 {
|
||||
return (epoch+1)<<p.logMapsPerEpoch - 1
|
||||
}
|
||||
|
||||
// rowIndex returns the row index in which the given log value should be marked
|
||||
// on the given map and mapping layer. Note that row assignments are re-shuffled
|
||||
// with a different frequency on each mapping layer, allowing efficient disk
|
||||
|
|
@ -125,17 +181,20 @@ func (p *Params) columnIndex(lvIndex uint64, logValue *common.Hash) uint32 {
|
|||
return uint32(lvIndex%p.valuesPerMap)<<hashBits + (uint32(hash>>(64-hashBits)) ^ uint32(hash)>>(32-hashBits))
|
||||
}
|
||||
|
||||
// maxRowLength returns the maximum length filter rows are populated up to
|
||||
// when using the given mapping layer. A log value can be marked on the map
|
||||
// according to a given mapping layer if the row mapping on that layer points
|
||||
// to a row that has not yet reached the maxRowLength belonging to that layer.
|
||||
// maxRowLength returns the maximum length filter rows are populated up to when
|
||||
// using the given mapping layer.
|
||||
//
|
||||
// A log value can be marked on the map according to a given mapping layer if
|
||||
// the row mapping on that layer points to a row that has not yet reached the
|
||||
// maxRowLength belonging to that layer.
|
||||
//
|
||||
// This means that a row that is considered full on a given layer may still be
|
||||
// extended further on a higher order layer.
|
||||
//
|
||||
// Each value is marked on the lowest order layer possible, assuming that marks
|
||||
// are added in ascending log value index order.
|
||||
// When searching for a log value one should consider all layers and process
|
||||
// corresponding rows up until the first one where the row mapped to the given
|
||||
// layer is not full.
|
||||
// are added in ascending log value index order. When searching for a log value
|
||||
// one should consider all layers and process corresponding rows up until the
|
||||
// first one where the row mapped to the given layer is not full.
|
||||
func (p *Params) maxRowLength(layerIndex uint32) uint32 {
|
||||
logLayerDiff := uint(layerIndex) * p.logLayerDiff
|
||||
if logLayerDiff > p.logMapsPerEpoch {
|
||||
|
|
|
|||
|
|
@ -97,15 +97,15 @@ func NewHeaderChain(chainDb ethdb.Database, config *params.ChainConfig, engine c
|
|||
|
||||
// GetBlockNumber retrieves the block number belonging to the given hash
|
||||
// from the cache or database
|
||||
func (hc *HeaderChain) GetBlockNumber(hash common.Hash) *uint64 {
|
||||
func (hc *HeaderChain) GetBlockNumber(hash common.Hash) (uint64, bool) {
|
||||
if cached, ok := hc.numberCache.Get(hash); ok {
|
||||
return &cached
|
||||
return cached, true
|
||||
}
|
||||
number := rawdb.ReadHeaderNumber(hc.chainDb, hash)
|
||||
if number != nil {
|
||||
hc.numberCache.Add(hash, *number)
|
||||
number, ok := rawdb.ReadHeaderNumber(hc.chainDb, hash)
|
||||
if ok {
|
||||
hc.numberCache.Add(hash, number)
|
||||
}
|
||||
return number
|
||||
return number, ok
|
||||
}
|
||||
|
||||
type headerWriteResult struct {
|
||||
|
|
@ -402,11 +402,11 @@ func (hc *HeaderChain) GetHeader(hash common.Hash, number uint64) *types.Header
|
|||
// GetHeaderByHash retrieves a block header from the database by hash, caching it if
|
||||
// found.
|
||||
func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header {
|
||||
number := hc.GetBlockNumber(hash)
|
||||
if number == nil {
|
||||
number, ok := hc.GetBlockNumber(hash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return hc.GetHeader(hash, *number)
|
||||
return hc.GetHeader(hash, number)
|
||||
}
|
||||
|
||||
// HasHeader checks if a block header is present in the database or not.
|
||||
|
|
|
|||
105
core/overlay/state_transition.go
Normal file
105
core/overlay/state_transition.go
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
// Copyright 2025 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// TransitionState is a structure that holds the progress markers of the
|
||||
// translation process.
|
||||
type TransitionState struct {
|
||||
CurrentAccountAddress *common.Address // addresss of the last translated account
|
||||
CurrentSlotHash common.Hash // hash of the last translated storage slot
|
||||
CurrentPreimageOffset int64 // next byte to read from the preimage file
|
||||
Started, Ended bool
|
||||
|
||||
// Mark whether the storage for an account has been processed. This is useful if the
|
||||
// maximum number of leaves of the conversion is reached before the whole storage is
|
||||
// processed.
|
||||
StorageProcessed bool
|
||||
|
||||
BaseRoot common.Hash // hash of the last read-only MPT base tree
|
||||
}
|
||||
|
||||
// InTransition returns true if the translation process is in progress.
|
||||
func (ts *TransitionState) InTransition() bool {
|
||||
return ts != nil && ts.Started && !ts.Ended
|
||||
}
|
||||
|
||||
// Transitioned returns true if the translation process has been completed.
|
||||
func (ts *TransitionState) Transitioned() bool {
|
||||
return ts != nil && ts.Ended
|
||||
}
|
||||
|
||||
// Copy returns a deep copy of the TransitionState object.
|
||||
func (ts *TransitionState) Copy() *TransitionState {
|
||||
ret := &TransitionState{
|
||||
Started: ts.Started,
|
||||
Ended: ts.Ended,
|
||||
CurrentSlotHash: ts.CurrentSlotHash,
|
||||
CurrentPreimageOffset: ts.CurrentPreimageOffset,
|
||||
StorageProcessed: ts.StorageProcessed,
|
||||
}
|
||||
if ts.CurrentAccountAddress != nil {
|
||||
addr := *ts.CurrentAccountAddress
|
||||
ret.CurrentAccountAddress = &addr
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// LoadTransitionState retrieves the Verkle transition state associated with
|
||||
// the given state root hash from the database.
|
||||
func LoadTransitionState(db ethdb.KeyValueReader, root common.Hash, isVerkle bool) *TransitionState {
|
||||
var ts *TransitionState
|
||||
|
||||
data, _ := rawdb.ReadVerkleTransitionState(db, root)
|
||||
|
||||
// if a state could be read from the db, attempt to decode it
|
||||
if len(data) > 0 {
|
||||
var (
|
||||
newts TransitionState
|
||||
buf = bytes.NewBuffer(data[:])
|
||||
dec = gob.NewDecoder(buf)
|
||||
)
|
||||
// Decode transition state
|
||||
err := dec.Decode(&newts)
|
||||
if err != nil {
|
||||
log.Error("failed to decode transition state", "err", err)
|
||||
return nil
|
||||
}
|
||||
ts = &newts
|
||||
}
|
||||
|
||||
// Fallback that should only happen before the transition
|
||||
if ts == nil {
|
||||
// Initialize the first transition state, with the "ended"
|
||||
// field set to true if the database was created
|
||||
// as a verkle database.
|
||||
log.Debug("no transition state found, starting fresh", "is verkle", db)
|
||||
|
||||
// Start with a fresh state
|
||||
ts = &TransitionState{Ended: isVerkle}
|
||||
}
|
||||
return ts
|
||||
}
|
||||
|
|
@ -143,13 +143,13 @@ func ReadAllCanonicalHashes(db ethdb.Iteratee, from uint64, to uint64, limit int
|
|||
}
|
||||
|
||||
// ReadHeaderNumber returns the header number assigned to a hash.
|
||||
func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 {
|
||||
func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) (uint64, bool) {
|
||||
data, _ := db.Get(headerNumberKey(hash))
|
||||
if len(data) != 8 {
|
||||
return nil
|
||||
return 0, false
|
||||
}
|
||||
number := binary.BigEndian.Uint64(data)
|
||||
return &number
|
||||
return number, true
|
||||
}
|
||||
|
||||
// WriteHeaderNumber stores the hash->number mapping.
|
||||
|
|
@ -449,9 +449,10 @@ func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
|
|||
return data
|
||||
}
|
||||
|
||||
// ReadCanonicalBodyRLP retrieves the block body (transactions and uncles) for the canonical
|
||||
// block at number, in RLP encoding.
|
||||
func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
|
||||
// ReadCanonicalBodyRLP retrieves the block body (transactions and uncles) for the
|
||||
// canonical block at number, in RLP encoding. Optionally it takes the block hash
|
||||
// to avoid looking it up
|
||||
func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64, hash *common.Hash) rlp.RawValue {
|
||||
var data []byte
|
||||
db.ReadAncients(func(reader ethdb.AncientReaderOp) error {
|
||||
data, _ = reader.Ancient(ChainFreezerBodiesTable, number)
|
||||
|
|
@ -459,10 +460,14 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
|
|||
return nil
|
||||
}
|
||||
// Block is not in ancients, read from leveldb by hash and number.
|
||||
// Note: ReadCanonicalHash cannot be used here because it also
|
||||
// calls ReadAncients internally.
|
||||
hash, _ := db.Get(headerHashKey(number))
|
||||
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hash)))
|
||||
if hash != nil {
|
||||
data, _ = db.Get(blockBodyKey(number, *hash))
|
||||
} else {
|
||||
// Note: ReadCanonicalHash cannot be used here because it also
|
||||
// calls ReadAncients internally.
|
||||
hashBytes, _ := db.Get(headerHashKey(number))
|
||||
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hashBytes)))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return data
|
||||
|
|
@ -544,6 +549,29 @@ func ReadReceiptsRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawVa
|
|||
return data
|
||||
}
|
||||
|
||||
// ReadCanonicalReceiptsRLP retrieves the receipts RLP for the canonical block at
|
||||
// number, in RLP encoding. Optionally it takes the block hash to avoid looking it up.
|
||||
func ReadCanonicalReceiptsRLP(db ethdb.Reader, number uint64, hash *common.Hash) rlp.RawValue {
|
||||
var data []byte
|
||||
db.ReadAncients(func(reader ethdb.AncientReaderOp) error {
|
||||
data, _ = reader.Ancient(ChainFreezerReceiptTable, number)
|
||||
if len(data) > 0 {
|
||||
return nil
|
||||
}
|
||||
// Block is not in ancients, read from leveldb by hash and number.
|
||||
if hash != nil {
|
||||
data, _ = db.Get(blockReceiptsKey(number, *hash))
|
||||
} else {
|
||||
// Note: ReadCanonicalHash cannot be used here because it also
|
||||
// calls ReadAncients internally.
|
||||
hashBytes, _ := db.Get(headerHashKey(number))
|
||||
data, _ = db.Get(blockReceiptsKey(number, common.BytesToHash(hashBytes)))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
// ReadRawReceipts retrieves all the transaction receipts belonging to a block.
|
||||
// The receipt metadata fields and the Bloom are not guaranteed to be populated,
|
||||
// so they should not be used. Use ReadReceipts instead if the metadata is needed.
|
||||
|
|
@ -907,11 +935,11 @@ func ReadHeadHeader(db ethdb.Reader) *types.Header {
|
|||
if headHeaderHash == (common.Hash{}) {
|
||||
return nil
|
||||
}
|
||||
headHeaderNumber := ReadHeaderNumber(db, headHeaderHash)
|
||||
if headHeaderNumber == nil {
|
||||
headHeaderNumber, ok := ReadHeaderNumber(db, headHeaderHash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return ReadHeader(db, headHeaderHash, *headHeaderNumber)
|
||||
return ReadHeader(db, headHeaderHash, headHeaderNumber)
|
||||
}
|
||||
|
||||
// ReadHeadBlock returns the current canonical head block.
|
||||
|
|
@ -920,9 +948,9 @@ func ReadHeadBlock(db ethdb.Reader) *types.Block {
|
|||
if headBlockHash == (common.Hash{}) {
|
||||
return nil
|
||||
}
|
||||
headBlockNumber := ReadHeaderNumber(db, headBlockHash)
|
||||
if headBlockNumber == nil {
|
||||
headBlockNumber, ok := ReadHeaderNumber(db, headBlockHash)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return ReadBlock(db, headBlockHash, *headBlockNumber)
|
||||
return ReadBlock(db, headBlockHash, headBlockNumber)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,6 +441,9 @@ func TestAncientStorage(t *testing.T) {
|
|||
if blob := ReadReceiptsRLP(db, hash, number); len(blob) > 0 {
|
||||
t.Fatalf("non existent receipts returned")
|
||||
}
|
||||
if blob := ReadCanonicalReceiptsRLP(db, number, &hash); len(blob) > 0 {
|
||||
t.Fatalf("non existent receipts returned")
|
||||
}
|
||||
|
||||
// Write and verify the header in the database
|
||||
WriteAncientBlocks(db, []*types.Block{block}, types.EncodeBlockReceiptLists([]types.Receipts{nil}))
|
||||
|
|
@ -454,6 +457,9 @@ func TestAncientStorage(t *testing.T) {
|
|||
if blob := ReadReceiptsRLP(db, hash, number); len(blob) == 0 {
|
||||
t.Fatalf("no receipts returned")
|
||||
}
|
||||
if blob := ReadCanonicalReceiptsRLP(db, number, &hash); len(blob) == 0 {
|
||||
t.Fatalf("no receipts returned")
|
||||
}
|
||||
|
||||
// Use a fake hash for data retrieval, nothing should be returned.
|
||||
fakeHash := common.BytesToHash([]byte{0x01, 0x02, 0x03})
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -40,7 +41,11 @@ func DecodeTxLookupEntry(data []byte, db ethdb.Reader) *uint64 {
|
|||
}
|
||||
// Database v4-v5 tx lookup format just stores the hash
|
||||
if len(data) == common.HashLength {
|
||||
return ReadHeaderNumber(db, common.BytesToHash(data))
|
||||
number, ok := ReadHeaderNumber(db, common.BytesToHash(data))
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return &number
|
||||
}
|
||||
// Finally try database v3 tx lookup format
|
||||
var entry LegacyTxLookupEntry
|
||||
|
|
@ -169,9 +174,10 @@ func findTxInBlockBody(blockbody rlp.RawValue, target common.Hash) (*types.Trans
|
|||
return nil, 0, errors.New("transaction not found")
|
||||
}
|
||||
|
||||
// ReadTransaction retrieves a specific transaction from the database, along with
|
||||
// its added positional metadata.
|
||||
func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) {
|
||||
// ReadCanonicalTransaction retrieves a specific transaction from the database, along
|
||||
// with its added positional metadata. Notably, only the transaction in the canonical
|
||||
// chain is visible.
|
||||
func ReadCanonicalTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) {
|
||||
blockNumber := ReadTxLookupEntry(db, hash)
|
||||
if blockNumber == nil {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
|
|
@ -180,7 +186,7 @@ func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, com
|
|||
if blockHash == (common.Hash{}) {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
}
|
||||
bodyRLP := ReadBodyRLP(db, blockHash, *blockNumber)
|
||||
bodyRLP := ReadCanonicalBodyRLP(db, *blockNumber, &blockHash)
|
||||
if bodyRLP == nil {
|
||||
log.Error("Transaction referenced missing", "number", *blockNumber, "hash", blockHash)
|
||||
return nil, common.Hash{}, 0, 0
|
||||
|
|
@ -193,9 +199,10 @@ func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, com
|
|||
return tx, blockHash, *blockNumber, txIndex
|
||||
}
|
||||
|
||||
// ReadReceipt retrieves a specific transaction receipt from the database, along with
|
||||
// its added positional metadata.
|
||||
func ReadReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig) (*types.Receipt, common.Hash, uint64, uint64) {
|
||||
// ReadCanonicalReceipt retrieves a specific transaction receipt from the database,
|
||||
// along with its added positional metadata. Notably, only the receipt in the canonical
|
||||
// chain is visible.
|
||||
func ReadCanonicalReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig) (*types.Receipt, common.Hash, uint64, uint64) {
|
||||
// Retrieve the context of the receipt based on the transaction hash
|
||||
blockNumber := ReadTxLookupEntry(db, hash)
|
||||
if blockNumber == nil {
|
||||
|
|
@ -220,7 +227,91 @@ func ReadReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig)
|
|||
return nil, common.Hash{}, 0, 0
|
||||
}
|
||||
|
||||
// ReadFilterMapRow retrieves a filter map row at the given mapRowIndex
|
||||
// extractReceiptFields takes a raw RLP-encoded receipt blob and extracts
|
||||
// specific fields from it.
|
||||
func extractReceiptFields(receiptRLP rlp.RawValue) (uint64, uint, error) {
|
||||
receiptList, _, err := rlp.SplitList(receiptRLP)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
// Decode the field: receipt status
|
||||
// for receipt before the byzantium fork:
|
||||
// - bytes: post state root
|
||||
// for receipt after the byzantium fork:
|
||||
// - bytes: receipt status flag
|
||||
_, _, rest, err := rlp.Split(receiptList)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
// Decode the field: cumulative gas used (type: uint64)
|
||||
gasUsed, rest, err := rlp.SplitUint64(rest)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
// Decode the field: logs (type: rlp list)
|
||||
logList, _, err := rlp.SplitList(rest)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
logCount, err := rlp.CountValues(logList)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
return gasUsed, uint(logCount), nil
|
||||
}
|
||||
|
||||
// RawReceiptContext carries the contextual information that is needed to derive
|
||||
// a complete receipt from a raw one.
|
||||
type RawReceiptContext struct {
|
||||
GasUsed uint64 // Amount of gas used by the associated transaction
|
||||
LogIndex uint // Starting index of the logs within the block
|
||||
}
|
||||
|
||||
// ReadCanonicalRawReceipt reads a raw receipt at the specified position. It also
|
||||
// returns the gas used by the associated transaction and the starting index of
|
||||
// the logs within the block. The main difference with ReadCanonicalReceipt is
|
||||
// that the additional positional fields are not directly included in the receipt.
|
||||
// Notably, only receipts from the canonical chain are visible.
|
||||
func ReadCanonicalRawReceipt(db ethdb.Reader, blockHash common.Hash, blockNumber, txIndex uint64) (*types.Receipt, RawReceiptContext, error) {
|
||||
receiptIt, err := rlp.NewListIterator(ReadCanonicalReceiptsRLP(db, blockNumber, &blockHash))
|
||||
if err != nil {
|
||||
return nil, RawReceiptContext{}, err
|
||||
}
|
||||
var (
|
||||
cumulativeGasUsed uint64
|
||||
logIndex uint
|
||||
)
|
||||
for i := uint64(0); i <= txIndex; i++ {
|
||||
// Unexpected iteration error
|
||||
if receiptIt.Err() != nil {
|
||||
return nil, RawReceiptContext{}, receiptIt.Err()
|
||||
}
|
||||
// Unexpected end of iteration
|
||||
if !receiptIt.Next() {
|
||||
return nil, RawReceiptContext{}, fmt.Errorf("receipt not found, %d, %x, %d", blockNumber, blockHash, txIndex)
|
||||
}
|
||||
if i == txIndex {
|
||||
var stored types.ReceiptForStorage
|
||||
if err := rlp.DecodeBytes(receiptIt.Value(), &stored); err != nil {
|
||||
return nil, RawReceiptContext{}, err
|
||||
}
|
||||
return (*types.Receipt)(&stored), RawReceiptContext{
|
||||
GasUsed: stored.CumulativeGasUsed - cumulativeGasUsed,
|
||||
LogIndex: logIndex,
|
||||
}, nil
|
||||
} else {
|
||||
gas, logs, err := extractReceiptFields(receiptIt.Value())
|
||||
if err != nil {
|
||||
return nil, RawReceiptContext{}, err
|
||||
}
|
||||
cumulativeGasUsed = gas
|
||||
logIndex += logs
|
||||
}
|
||||
}
|
||||
return nil, RawReceiptContext{}, fmt.Errorf("receipt not found, %d, %x, %d", blockNumber, blockHash, txIndex)
|
||||
}
|
||||
|
||||
// ReadFilterMapExtRow retrieves a filter map row at the given mapRowIndex
|
||||
// (see filtermaps.mapRowIndex for the storage index encoding).
|
||||
// Note that zero length rows are not stored in the database and therefore all
|
||||
// non-existent entries are interpreted as empty rows and return no error.
|
||||
|
|
@ -247,7 +338,7 @@ func ReadFilterMapExtRow(db ethdb.KeyValueReader, mapRowIndex uint64, bitLength
|
|||
return nil, err
|
||||
}
|
||||
if len(encRow)%byteLength != 0 {
|
||||
return nil, errors.New("Invalid encoded extended filter row length")
|
||||
return nil, errors.New("invalid encoded extended filter row length")
|
||||
}
|
||||
row := make([]uint32, len(encRow)/byteLength)
|
||||
var b [4]byte
|
||||
|
|
@ -301,7 +392,7 @@ func ReadFilterMapBaseRows(db ethdb.KeyValueReader, mapRowIndex uint64, rowCount
|
|||
headerBits--
|
||||
}
|
||||
if headerLen+byteLength*entryCount > encLen {
|
||||
return nil, errors.New("Invalid encoded base filter rows length")
|
||||
return nil, errors.New("invalid encoded base filter rows length")
|
||||
}
|
||||
if entriesInRow > 0 {
|
||||
rows[rowIndex] = make([]uint32, entriesInRow)
|
||||
|
|
@ -318,8 +409,8 @@ func ReadFilterMapBaseRows(db ethdb.KeyValueReader, mapRowIndex uint64, rowCount
|
|||
return rows, nil
|
||||
}
|
||||
|
||||
// WriteFilterMapRow stores a filter map row at the given mapRowIndex or deletes
|
||||
// any existing entry if the row is empty.
|
||||
// WriteFilterMapExtRow stores an extended filter map row at the given mapRowIndex
|
||||
// or deletes any existing entry if the row is empty.
|
||||
func WriteFilterMapExtRow(db ethdb.KeyValueWriter, mapRowIndex uint64, row []uint32, bitLength uint) {
|
||||
byteLength := int(bitLength) / 8
|
||||
if int(bitLength) != byteLength*8 {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package rawdb
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
|
|
@ -88,7 +89,7 @@ func TestLookupStorage(t *testing.T) {
|
|||
|
||||
// Check that no transactions entries are in a pristine database
|
||||
for i, tx := range txs {
|
||||
if txn, _, _, _ := ReadTransaction(db, tx.Hash()); txn != nil {
|
||||
if txn, _, _, _ := ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
|
||||
t.Fatalf("tx #%d [%x]: non existent transaction returned: %v", i, tx.Hash(), txn)
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +99,7 @@ func TestLookupStorage(t *testing.T) {
|
|||
tc.writeTxLookupEntriesByBlock(db, block)
|
||||
|
||||
for i, tx := range txs {
|
||||
if txn, hash, number, index := ReadTransaction(db, tx.Hash()); txn == nil {
|
||||
if txn, hash, number, index := ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
|
||||
t.Fatalf("tx #%d [%x]: transaction not found", i, tx.Hash())
|
||||
} else {
|
||||
if hash != block.Hash() || number != block.NumberU64() || index != uint64(i) {
|
||||
|
|
@ -112,7 +113,7 @@ func TestLookupStorage(t *testing.T) {
|
|||
// Delete the transactions and check purge
|
||||
for i, tx := range txs {
|
||||
DeleteTxLookupEntry(db, tx.Hash())
|
||||
if txn, _, _, _ := ReadTransaction(db, tx.Hash()); txn != nil {
|
||||
if txn, _, _, _ := ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
|
||||
t.Fatalf("tx #%d [%x]: deleted transaction returned: %v", i, tx.Hash(), txn)
|
||||
}
|
||||
}
|
||||
|
|
@ -219,3 +220,80 @@ func TestFindTxInBlockBody(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractReceiptFields(t *testing.T) {
|
||||
receiptWithPostState := types.ReceiptForStorage(types.Receipt{
|
||||
Type: types.LegacyTxType,
|
||||
PostState: []byte{0x1, 0x2, 0x3},
|
||||
CumulativeGasUsed: 100,
|
||||
})
|
||||
receiptWithPostStateBlob, _ := rlp.EncodeToBytes(&receiptWithPostState)
|
||||
|
||||
receiptNoLogs := types.ReceiptForStorage(types.Receipt{
|
||||
Type: types.LegacyTxType,
|
||||
Status: types.ReceiptStatusSuccessful,
|
||||
CumulativeGasUsed: 100,
|
||||
})
|
||||
receiptNoLogBlob, _ := rlp.EncodeToBytes(&receiptNoLogs)
|
||||
|
||||
receiptWithLogs := types.ReceiptForStorage(types.Receipt{
|
||||
Type: types.LegacyTxType,
|
||||
Status: types.ReceiptStatusSuccessful,
|
||||
CumulativeGasUsed: 100,
|
||||
Logs: []*types.Log{
|
||||
{
|
||||
Address: common.BytesToAddress([]byte{0x1}),
|
||||
Topics: []common.Hash{
|
||||
common.BytesToHash([]byte{0x1}),
|
||||
},
|
||||
Data: []byte{0x1},
|
||||
},
|
||||
{
|
||||
Address: common.BytesToAddress([]byte{0x2}),
|
||||
Topics: []common.Hash{
|
||||
common.BytesToHash([]byte{0x2}),
|
||||
},
|
||||
Data: []byte{0x2},
|
||||
},
|
||||
},
|
||||
})
|
||||
receiptWithLogBlob, _ := rlp.EncodeToBytes(&receiptWithLogs)
|
||||
|
||||
invalidReceipt := types.ReceiptForStorage(types.Receipt{
|
||||
Type: types.LegacyTxType,
|
||||
Status: types.ReceiptStatusSuccessful,
|
||||
CumulativeGasUsed: 100,
|
||||
})
|
||||
invalidReceiptBlob, _ := rlp.EncodeToBytes(&invalidReceipt)
|
||||
invalidReceiptBlob[len(invalidReceiptBlob)-1] = 0xf
|
||||
|
||||
var cases = []struct {
|
||||
logs rlp.RawValue
|
||||
expErr error
|
||||
expGasUsed uint64
|
||||
expLogs uint
|
||||
}{
|
||||
{receiptWithPostStateBlob, nil, 100, 0},
|
||||
{receiptNoLogBlob, nil, 100, 0},
|
||||
{receiptWithLogBlob, nil, 100, 2},
|
||||
{invalidReceiptBlob, rlp.ErrExpectedList, 100, 0},
|
||||
}
|
||||
for _, c := range cases {
|
||||
gasUsed, logs, err := extractReceiptFields(c.logs)
|
||||
if c.expErr != nil {
|
||||
if !errors.Is(err, c.expErr) {
|
||||
t.Fatalf("Unexpected error, want: %v, got: %v", c.expErr, err)
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
if gasUsed != c.expGasUsed {
|
||||
t.Fatalf("Unexpected gas used, want %d, got %d", c.expGasUsed, gasUsed)
|
||||
}
|
||||
if logs != c.expLogs {
|
||||
t.Fatalf("Unexpected logs, want %d, got %d", c.expLogs, logs)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
core/rawdb/accessors_overlay.go
Normal file
30
core/rawdb/accessors_overlay.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2025 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package rawdb
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
)
|
||||
|
||||
func ReadVerkleTransitionState(db ethdb.KeyValueReader, hash common.Hash) ([]byte, error) {
|
||||
return db.Get(transitionStateKey(hash))
|
||||
}
|
||||
|
||||
func WriteVerkleTransitionState(db ethdb.KeyValueWriter, hash common.Hash, state []byte) error {
|
||||
return db.Put(transitionStateKey(hash), state)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue