mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-01 17:43:45 +00:00
Compare commits
No commits in common. "master" and "v1.15.8" have entirely different histories.
1169 changed files with 49104 additions and 157237 deletions
|
|
@ -1,27 +0,0 @@
|
|||
on:
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Run cleanup script
|
||||
run: |
|
||||
go run build/ci.go purge -store gethstore/builds -days 14
|
||||
env:
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
on:
|
||||
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
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Show environment
|
||||
run: |
|
||||
env
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Install deb toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install devscripts debhelper dput fakeroot
|
||||
|
||||
- name: Add launchpad to known_hosts
|
||||
run: |
|
||||
echo '|1|7SiYPr9xl3uctzovOTj4gMwAC1M=|t6ReES75Bo/PxlOPJ6/GsGbTrM0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0aKz5UTUndYgIGG7dQBV+HaeuEZJ2xPHo2DS2iSKvUL4xNMSAY4UguNW+pX56nAQmZKIZZ8MaEvSj6zMEDiq6HFfn5JcTlM80UwlnyKe8B8p7Nk06PPQLrnmQt5fh0HmEcZx+JU9TZsfCHPnX7MNz4ELfZE6cFsclClrKim3BHUIGq//t93DllB+h4O9LHjEUsQ1Sr63irDLSutkLJD6RXchjROXkNirlcNVHH/jwLWR5RcYilNX7S5bIkK8NlWPjsn/8Ua5O7I9/YoE97PpO6i73DTGLh5H9JN/SITwCKBkgSDWUt61uPK3Y11Gty7o2lWsBjhBUm2Y38CBsoGmBw==' >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Run ci.go
|
||||
run: |
|
||||
go run build/ci.go debsrc -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>"
|
||||
env:
|
||||
PPA_SIGNING_KEY: ${{ secrets.PPA_SIGNING_KEY }}
|
||||
PPA_SSH_KEY: ${{ secrets.PPA_SSH_KEY }}
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
linux-intel:
|
||||
name: Linux Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Install cross toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
|
||||
|
||||
- name: Build (amd64)
|
||||
run: |
|
||||
go run build/ci.go install -static -arch amd64 -dlgo
|
||||
|
||||
- name: Create/upload archive (amd64)
|
||||
run: |
|
||||
go run build/ci.go archive -arch amd64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
rm -f build/bin/*
|
||||
env:
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: Build (386)
|
||||
run: |
|
||||
go run build/ci.go install -static -arch 386 -dlgo
|
||||
|
||||
- name: Create/upload archive (386)
|
||||
run: |
|
||||
go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
rm -f build/bin/*
|
||||
env:
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
linux-arm:
|
||||
name: Linux Build (arm)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Install cross toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
||||
ln -s /usr/include/asm-generic /usr/include/asm
|
||||
|
||||
- name: Build (arm64)
|
||||
run: |
|
||||
go run build/ci.go install -static -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
|
||||
|
||||
- name: Create/upload archive (arm64)
|
||||
run: |
|
||||
go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
rm -fr build/bin/*
|
||||
env:
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: Run build (arm5)
|
||||
run: |
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "5"
|
||||
|
||||
- name: Create/upload archive (arm5)
|
||||
run: |
|
||||
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
env:
|
||||
GOARM: "5"
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: Run build (arm6)
|
||||
run: |
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "6"
|
||||
|
||||
- name: Create/upload archive (arm6)
|
||||
run: |
|
||||
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
rm -fr build/bin/*
|
||||
env:
|
||||
GOARM: "6"
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: Run build (arm7)
|
||||
run: |
|
||||
go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
env:
|
||||
GOARM: "7"
|
||||
|
||||
- name: Create/upload archive (arm7)
|
||||
run: |
|
||||
go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
|
||||
rm -fr build/bin/*
|
||||
env:
|
||||
GOARM: "7"
|
||||
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
keeper:
|
||||
name: Keeper Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Install cross toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
|
||||
|
||||
- name: Build (amd64)
|
||||
run: |
|
||||
go run build/ci.go keeper -dlgo
|
||||
|
||||
windows:
|
||||
name: Windows Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Install cross toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install \
|
||||
gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 nsis
|
||||
|
||||
- name: "Build (amd64)"
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -os windows -arch amd64 -cc x86_64-w64-mingw32-gcc
|
||||
|
||||
- name: "Create/upload archive (amd64)"
|
||||
run: |
|
||||
go run build/ci.go archive -os windows -arch amd64 -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
env:
|
||||
WINDOWS_SIGNING_KEY: ${{ secrets.WINDOWS_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: "Create/upload NSIS installer (amd64)"
|
||||
run: |
|
||||
go run build/ci.go nsis -arch amd64 -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
rm -f build/bin/*
|
||||
env:
|
||||
WINDOWS_SIGNING_KEY: ${{ secrets.WINDOWS_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: "Build (386)"
|
||||
run: |
|
||||
go run build/ci.go install -dlgo -os windows -arch 386 -cc i686-w64-mingw32-gcc
|
||||
|
||||
- name: "Create/upload archive (386)"
|
||||
run: |
|
||||
go run build/ci.go archive -os windows -arch 386 -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
env:
|
||||
WINDOWS_SIGNING_KEY: ${{ secrets.WINDOWS_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
- name: "Create/upload NSIS installer (386)"
|
||||
run: |
|
||||
go run build/ci.go nsis -arch 386 -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
rm -f build/bin/*
|
||||
env:
|
||||
WINDOWS_SIGNING_KEY: ${{ secrets.WINDOWS_SIGNING_KEY }}
|
||||
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
|
||||
|
||||
docker:
|
||||
name: Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
cache: false
|
||||
|
||||
- name: Run docker build
|
||||
env:
|
||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
run: |
|
||||
go run build/ci.go dockerx -platform linux/amd64,linux/arm64,linux/riscv64 -upload
|
||||
27
.github/CODEOWNERS
vendored
27
.github/CODEOWNERS
vendored
|
|
@ -9,23 +9,28 @@ beacon/light/ @zsfelfoldi
|
|||
beacon/merkle/ @zsfelfoldi
|
||||
beacon/types/ @zsfelfoldi @fjl
|
||||
beacon/params/ @zsfelfoldi @fjl
|
||||
cmd/evm/ @MariusVanDerWijden @lightclient
|
||||
cmd/keeper/ @gballet
|
||||
core/state/ @rjl493456442
|
||||
crypto/ @gballet @jwasinger @fjl
|
||||
core/ @rjl493456442
|
||||
eth/ @rjl493456442
|
||||
cmd/clef/ @holiman
|
||||
cmd/evm/ @holiman @MariusVanDerWijden @lightclient
|
||||
core/state/ @rjl493456442 @holiman
|
||||
crypto/ @gballet @jwasinger @holiman @fjl
|
||||
core/ @holiman @rjl493456442
|
||||
eth/ @holiman @rjl493456442
|
||||
eth/catalyst/ @MariusVanDerWijden @lightclient @fjl @jwasinger
|
||||
eth/tracers/ @s1na
|
||||
ethclient/ @fjl
|
||||
ethdb/ @rjl493456442
|
||||
event/ @fjl
|
||||
trie/ @rjl493456442 @gballet
|
||||
trie/ @rjl493456442
|
||||
triedb/ @rjl493456442
|
||||
internal/ethapi/ @fjl @lightclient
|
||||
core/tracing/ @s1na
|
||||
graphql/ @s1na
|
||||
internal/ethapi/ @fjl @s1na @lightclient
|
||||
internal/era/ @lightclient
|
||||
miner/ @MariusVanDerWijden @fjl @rjl493456442
|
||||
metrics/ @holiman
|
||||
miner/ @MariusVanDerWijden @holiman @fjl @rjl493456442
|
||||
node/ @fjl
|
||||
p2p/ @fjl @zsfelfoldi
|
||||
rlp/ @fjl
|
||||
params/ @fjl @gballet @rjl493456442 @zsfelfoldi
|
||||
rpc/ @fjl
|
||||
params/ @fjl @holiman @karalabe @gballet @rjl493456442 @zsfelfoldi
|
||||
rpc/ @fjl @holiman
|
||||
signer/ @holiman
|
||||
|
|
|
|||
29
.github/workflows/freebsd.yml
vendored
29
.github/workflows/freebsd.yml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- freebsd-github-action
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: FreeBSD-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
- name: Test in FreeBSD
|
||||
id: test
|
||||
uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
release: "15.0"
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y go
|
||||
run: |
|
||||
freebsd-version
|
||||
uname -a
|
||||
go version
|
||||
go run ./build/ci.go test -p 8
|
||||
123
.github/workflows/go.yml
vendored
123
.github/workflows/go.yml
vendored
|
|
@ -1,25 +1,18 @@
|
|||
name: i386 linux tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
# Free runner capacity by cancelling superseded PR runs.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: [self-hosted-ghr, size-s-x64]
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
# Cache build tools to avoid downloading them each time
|
||||
- uses: actions/cache@v4
|
||||
|
|
@ -30,7 +23,7 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.25
|
||||
go-version: 1.23.0
|
||||
cache: false
|
||||
|
||||
- name: Run linters
|
||||
|
|
@ -39,107 +32,17 @@ jobs:
|
|||
go run build/ci.go check_generate
|
||||
go run build/ci.go check_baddeps
|
||||
|
||||
keeper:
|
||||
name: Keeper Builds
|
||||
needs: test
|
||||
runs-on: [self-hosted-ghr, size-l-x64]
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25'
|
||||
go-version: 1.24.0
|
||||
cache: false
|
||||
|
||||
- name: Build
|
||||
run: go run build/ci.go keeper
|
||||
|
||||
test-32bit:
|
||||
name: "32bit tests"
|
||||
needs: test
|
||||
runs-on: [self-hosted-ghr, size-l-x64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25'
|
||||
cache: false
|
||||
|
||||
- name: Install cross toolchain
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
|
||||
|
||||
- name: Build
|
||||
run: go run build/ci.go test -arch 386 -short -p 8
|
||||
|
||||
test:
|
||||
name: Test
|
||||
needs: lint
|
||||
runs-on: [self-hosted-ghr, size-l-x64]
|
||||
strategy:
|
||||
matrix:
|
||||
go:
|
||||
- '1.25'
|
||||
- '1.24'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: false
|
||||
|
||||
- name: Run tests
|
||||
run: go run build/ci.go test -p 8
|
||||
|
||||
windows:
|
||||
name: Windows ${{ matrix.arch }}
|
||||
needs: lint
|
||||
runs-on: [self-hosted, windows, x64]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: amd64
|
||||
mingw: 'C:\msys64\mingw64'
|
||||
test: true
|
||||
- arch: '386'
|
||||
mingw: 'C:\msys64\mingw32'
|
||||
test: false
|
||||
env:
|
||||
GETH_MINGW: ${{ matrix.mingw }}
|
||||
GETH_CC: ${{ matrix.mingw }}\bin\gcc.exe
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25'
|
||||
cache: false
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
set PATH=%GETH_MINGW%\bin;%PATH%
|
||||
go run build/ci.go install -arch ${{ matrix.arch }} -cc %GETH_CC%
|
||||
|
||||
- name: Run tests
|
||||
if: matrix.test
|
||||
shell: cmd
|
||||
run: |
|
||||
set PATH=%GETH_MINGW%\bin;%PATH%
|
||||
go run build/ci.go test -arch ${{ matrix.arch }} -cc %GETH_CC% -short -p 8
|
||||
run: go test -short ./...
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: 386
|
||||
|
|
|
|||
83
.github/workflows/validate_pr.yml
vendored
83
.github/workflows/validate_pr.yml
vendored
|
|
@ -1,83 +0,0 @@
|
|||
name: PR Format Validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize]
|
||||
|
||||
jobs:
|
||||
validate-pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check for Spam PR
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const prTitle = context.payload.pull_request.title;
|
||||
const spamRegex = /^(feat|chore|fix)(\(.*\))?\s*:/i;
|
||||
|
||||
if (spamRegex.test(prTitle)) {
|
||||
// Leave a comment explaining why
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
body: `## PR Closed as Spam
|
||||
|
||||
This PR was automatically closed because the title format \`feat:\`, \`fix:\`, or \`chore:\` is commonly associated with spam contributions.
|
||||
|
||||
If this is a legitimate contribution, please:
|
||||
1. Review our contribution guidelines
|
||||
2. Use the correct PR title format: \`directory, ...: description\`
|
||||
3. Open a new PR with the proper title format
|
||||
|
||||
Thank you for your understanding.`
|
||||
});
|
||||
|
||||
// Close the PR
|
||||
await github.rest.pulls.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.payload.pull_request.number,
|
||||
state: 'closed'
|
||||
});
|
||||
|
||||
core.setFailed('PR closed as spam due to suspicious title format');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ PR passed spam check');
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check PR Title Format
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const prTitle = context.payload.pull_request.title;
|
||||
const titleRegex = /^([\w\s,{}/.]+): .+/;
|
||||
|
||||
if (!titleRegex.test(prTitle)) {
|
||||
core.setFailed(`PR title "${prTitle}" does not match required format: directory, ...: description`);
|
||||
return;
|
||||
}
|
||||
|
||||
const match = prTitle.match(titleRegex);
|
||||
const dirPart = match[1];
|
||||
const directories = dirPart.split(',').map(d => d.trim());
|
||||
const missingDirs = [];
|
||||
for (const dir of directories) {
|
||||
const fullPath = path.join(process.env.GITHUB_WORKSPACE, dir);
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
missingDirs.push(dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingDirs.length > 0) {
|
||||
core.setFailed(`The following directories in the PR title do not exist: ${missingDirs.join(', ')}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ PR title format is valid');
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -55,5 +55,4 @@ cmd/ethkey/ethkey
|
|||
cmd/evm/evm
|
||||
cmd/geth/geth
|
||||
cmd/rlpdump/rlpdump
|
||||
cmd/workload/workload
|
||||
cmd/keeper/keeper
|
||||
cmd/workload/workload
|
||||
10
.mailmap
10
.mailmap
|
|
@ -48,15 +48,8 @@ Bas van Kervel <bas@ethdev.com> <bas-vk@users.noreply.github.com>
|
|||
Boqin Qin <bobbqqin@bupt.edu.cn>
|
||||
Boqin Qin <bobbqqin@bupt.edu.cn> <Bobbqqin@gmail.com>
|
||||
|
||||
Bosul Mun <bsbs8645@snu.ac.kr>
|
||||
Bosul Mun <bsbs8645@snu.ac.kr> <bosul.mun@ethereum.org>
|
||||
|
||||
Casey Detrio <cdetrio@gmail.com>
|
||||
|
||||
Charlotte <tqpcharlie@proton.me>
|
||||
Charlotte <tqpcharlie@proton.me> <Zachinquarantine@protonmail.com>
|
||||
Charlotte <tqpcharlie@proton.me> <zachinquarantine@yahoo.com>
|
||||
|
||||
Cheng Li <lob4tt@gmail.com>
|
||||
|
||||
Chris Ziogas <ziogaschr@gmail.com>
|
||||
|
|
@ -308,6 +301,9 @@ Yohann Léon <sybiload@gmail.com>
|
|||
yzb <335357057@qq.com>
|
||||
yzb <335357057@qq.com> <flyingyzb@gmail.com>
|
||||
|
||||
Zachinquarantine <Zachinquarantine@protonmail.com>
|
||||
Zachinquarantine <Zachinquarantine@protonmail.com> <zachinquarantine@yahoo.com>
|
||||
|
||||
Ziyuan Zhong <zzy.albert@163.com>
|
||||
|
||||
Zsolt Felföldi <zsfelfoldi@gmail.com>
|
||||
|
|
|
|||
115
.travis.yml
Normal file
115
.travis.yml
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
language: go
|
||||
go_import_path: github.com/ethereum/go-ethereum
|
||||
sudo: false
|
||||
jobs:
|
||||
include:
|
||||
# This builder create and push the Docker images for all architectures
|
||||
- stage: build
|
||||
if: type = push
|
||||
os: linux
|
||||
arch: amd64
|
||||
dist: focal
|
||||
go: 1.24.x
|
||||
env:
|
||||
- docker
|
||||
services:
|
||||
- docker
|
||||
git:
|
||||
submodules: false # avoid cloning ethereum/tests
|
||||
before_install:
|
||||
- export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
script:
|
||||
- go run build/ci.go dockerx -platform "linux/amd64,linux/arm64,linux/riscv64" -hub ethereum/client-go -upload
|
||||
|
||||
# This builder does the Linux Azure uploads
|
||||
- stage: build
|
||||
if: type = push
|
||||
os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
go: 1.24.x
|
||||
env:
|
||||
- azure-linux
|
||||
git:
|
||||
submodules: false # avoid cloning ethereum/tests
|
||||
script:
|
||||
# build amd64
|
||||
- go run build/ci.go install -dlgo
|
||||
- go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
|
||||
# build 386
|
||||
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
|
||||
- git status --porcelain
|
||||
- go run build/ci.go install -dlgo -arch 386
|
||||
- go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
|
||||
# Switch over GCC to cross compilation (breaks 386, hence why do it here only)
|
||||
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
||||
- sudo ln -s /usr/include/asm-generic /usr/include/asm
|
||||
|
||||
- GOARM=5 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
- GOARM=5 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
- GOARM=6 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
|
||||
- GOARM=6 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
- GOARM=7 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabihf-gcc
|
||||
- GOARM=7 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
- go run build/ci.go install -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
|
||||
- go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
|
||||
|
||||
# These builders run the tests
|
||||
- stage: build
|
||||
if: type = push
|
||||
os: linux
|
||||
arch: amd64
|
||||
dist: focal
|
||||
go: 1.24.x
|
||||
script:
|
||||
- travis_wait 45 go run build/ci.go test $TEST_PACKAGES
|
||||
|
||||
- stage: build
|
||||
if: type = push
|
||||
os: linux
|
||||
dist: focal
|
||||
go: 1.23.x
|
||||
script:
|
||||
- travis_wait 45 go run build/ci.go test $TEST_PACKAGES
|
||||
|
||||
# This builder does the Ubuntu PPA nightly uploads
|
||||
- stage: build
|
||||
if: type = cron || (type = push && tag ~= /^v[0-9]/)
|
||||
os: linux
|
||||
dist: focal
|
||||
go: 1.24.x
|
||||
env:
|
||||
- ubuntu-ppa
|
||||
git:
|
||||
submodules: false # avoid cloning ethereum/tests
|
||||
before_install:
|
||||
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install devscripts debhelper dput fakeroot
|
||||
script:
|
||||
- echo '|1|7SiYPr9xl3uctzovOTj4gMwAC1M=|t6ReES75Bo/PxlOPJ6/GsGbTrM0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0aKz5UTUndYgIGG7dQBV+HaeuEZJ2xPHo2DS2iSKvUL4xNMSAY4UguNW+pX56nAQmZKIZZ8MaEvSj6zMEDiq6HFfn5JcTlM80UwlnyKe8B8p7Nk06PPQLrnmQt5fh0HmEcZx+JU9TZsfCHPnX7MNz4ELfZE6cFsclClrKim3BHUIGq//t93DllB+h4O9LHjEUsQ1Sr63irDLSutkLJD6RXchjROXkNirlcNVHH/jwLWR5RcYilNX7S5bIkK8NlWPjsn/8Ua5O7I9/YoE97PpO6i73DTGLh5H9JN/SITwCKBkgSDWUt61uPK3Y11Gty7o2lWsBjhBUm2Y38CBsoGmBw==' >> ~/.ssh/known_hosts
|
||||
- go run build/ci.go debsrc -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>"
|
||||
|
||||
# This builder does the Azure archive purges to avoid accumulating junk
|
||||
- stage: build
|
||||
if: type = cron
|
||||
os: linux
|
||||
dist: focal
|
||||
go: 1.24.x
|
||||
env:
|
||||
- azure-purge
|
||||
git:
|
||||
submodules: false # avoid cloning ethereum/tests
|
||||
script:
|
||||
- go run build/ci.go purge -store gethstore/builds -days 14
|
||||
|
||||
# This builder executes race tests
|
||||
- stage: build
|
||||
if: type = cron
|
||||
os: linux
|
||||
dist: focal
|
||||
go: 1.24.x
|
||||
env:
|
||||
- racetests
|
||||
script:
|
||||
- travis_wait 60 go run build/ci.go test -race $TEST_PACKAGES
|
||||
102
AGENTS.md
102
AGENTS.md
|
|
@ -1,102 +0,0 @@
|
|||
# AGENTS
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Keep changes minimal and focused.** Only modify code directly related to the task at hand. Do not refactor unrelated code, rename existing variables or functions for style, or bundle unrelated fixes into the same commit or PR.
|
||||
- **Do not add, remove, or update dependencies** unless the task explicitly requires it.
|
||||
|
||||
## Pre-Commit Checklist
|
||||
|
||||
Before every commit, run **all** of the following checks and ensure they pass:
|
||||
|
||||
### 1. Formatting
|
||||
|
||||
Before committing, always run `gofmt` and `goimports` on all modified files:
|
||||
|
||||
```sh
|
||||
gofmt -w <modified files>
|
||||
goimports -w <modified files>
|
||||
```
|
||||
|
||||
### 2. Build All Commands
|
||||
|
||||
Verify that all tools compile successfully:
|
||||
|
||||
```sh
|
||||
make all
|
||||
```
|
||||
|
||||
This builds all executables under `cmd/`, including `keeper` which has special build requirements.
|
||||
|
||||
### 3. Tests
|
||||
|
||||
While iterating during development, use `-short` for faster feedback:
|
||||
|
||||
```sh
|
||||
go run ./build/ci.go test -short
|
||||
```
|
||||
|
||||
Before committing, run the full test suite **without** `-short` to ensure all tests pass, including the Ethereum execution-spec tests and all state/block test permutations:
|
||||
|
||||
```sh
|
||||
go run ./build/ci.go test
|
||||
```
|
||||
|
||||
### 4. Linting
|
||||
|
||||
```sh
|
||||
go run ./build/ci.go lint
|
||||
```
|
||||
|
||||
This runs additional style checks. Fix any issues before committing.
|
||||
|
||||
### 5. Generated Code
|
||||
|
||||
```sh
|
||||
go run ./build/ci.go check_generate
|
||||
```
|
||||
|
||||
Ensures that all generated files (e.g., `gen_*.go`) are up to date. If this fails, first install the required code generators by running `make devtools`, then run the appropriate `go generate` commands and include the updated files in your commit.
|
||||
|
||||
### 6. Dependency Hygiene
|
||||
|
||||
```sh
|
||||
go run ./build/ci.go check_baddeps
|
||||
```
|
||||
|
||||
Verifies that no forbidden dependencies have been introduced.
|
||||
|
||||
## What to include in commits
|
||||
|
||||
Do not commit binaries, whether they are produced by the main build or byproducts of investigations.
|
||||
|
||||
## Commit Message Format
|
||||
|
||||
Commit messages must be prefixed with the package(s) they modify, followed by a short lowercase description:
|
||||
|
||||
```
|
||||
<package(s)>: description
|
||||
```
|
||||
|
||||
Examples:
|
||||
- `core/vm: fix stack overflow in PUSH instruction`
|
||||
- `eth, rpc: make trace configs optional`
|
||||
- `cmd/geth: add new flag for sync mode`
|
||||
|
||||
Use comma-separated package names when multiple areas are affected. Keep the description concise.
|
||||
|
||||
## Pull Request Title Format
|
||||
|
||||
PR titles follow the same convention as commit messages:
|
||||
|
||||
```
|
||||
<list of modified paths>: description
|
||||
```
|
||||
|
||||
Examples:
|
||||
- `core/vm: fix stack overflow in PUSH instruction`
|
||||
- `core, eth: add arena allocator support`
|
||||
- `cmd/geth, internal/ethapi: refactor transaction args`
|
||||
- `trie/archiver: streaming subtree archival to fix OOM`
|
||||
|
||||
Use the top-level package paths, comma-separated if multiple areas are affected. Only mention the directories with functional changes, interface changes that trickle all over the codebase should not generate an exhaustive list. The description should be a short, lowercase summary of the change.
|
||||
2
AUTHORS
2
AUTHORS
|
|
@ -123,7 +123,6 @@ Ceyhun Onur <ceyhun.onur@avalabs.org>
|
|||
chabashilah <doumodoumo@gmail.com>
|
||||
changhong <changhong.yu@shanbay.com>
|
||||
Charles Cooper <cooper.charles.m@gmail.com>
|
||||
Charlotte <tqpcharlie@proton.me>
|
||||
Chase Wright <mysticryuujin@gmail.com>
|
||||
Chawin Aiemvaravutigul <nick41746@hotmail.com>
|
||||
Chen Quan <terasum@163.com>
|
||||
|
|
@ -840,6 +839,7 @@ ywzqwwt <39263032+ywzqwwt@users.noreply.github.com>
|
|||
yzb <335357057@qq.com>
|
||||
zaccoding <zaccoding725@gmail.com>
|
||||
Zach <zach.ramsay@gmail.com>
|
||||
Zachinquarantine <Zachinquarantine@protonmail.com>
|
||||
zah <zahary@gmail.com>
|
||||
Zahoor Mohamed <zahoor@zahoor.in>
|
||||
Zak Cole <zak@beattiecole.com>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ ARG VERSION=""
|
|||
ARG BUILDNUM=""
|
||||
|
||||
# Build Geth in a stock Go builder container
|
||||
FROM golang:1.26-alpine AS builder
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache gcc musl-dev linux-headers git
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ ARG VERSION=""
|
|||
ARG BUILDNUM=""
|
||||
|
||||
# Build Geth in a stock Go builder container
|
||||
FROM golang:1.26-alpine AS builder
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache gcc musl-dev linux-headers git
|
||||
|
||||
|
|
|
|||
8
Makefile
8
Makefile
|
|
@ -2,7 +2,7 @@
|
|||
# with Go source code. If you know what GOPATH is then you probably
|
||||
# don't need to bother with make.
|
||||
|
||||
.PHONY: geth evm all test lint fmt clean devtools help
|
||||
.PHONY: geth all test lint fmt clean devtools help
|
||||
|
||||
GOBIN = ./build/bin
|
||||
GO ?= latest
|
||||
|
|
@ -14,12 +14,6 @@ geth:
|
|||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||
|
||||
#? evm: Build evm.
|
||||
evm:
|
||||
$(GORUN) build/ci.go install ./cmd/evm
|
||||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/evm\" to launch evm."
|
||||
|
||||
#? all: Build all packages and executables.
|
||||
all:
|
||||
$(GORUN) build/ci.go install
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ https://pkg.go.dev/badge/github.com/ethereum/go-ethereum
|
|||
[](https://goreportcard.com/report/github.com/ethereum/go-ethereum)
|
||||
[](https://app.travis-ci.com/github/ethereum/go-ethereum)
|
||||
[](https://discord.gg/nthXNEv)
|
||||
[](https://x.com/go_ethereum)
|
||||
|
||||
Automated builds are available for stable releases and the unstable master branch. Binary
|
||||
archives are published at https://geth.ethereum.org/downloads/.
|
||||
|
|
@ -38,6 +37,7 @@ directory.
|
|||
| Command | Description |
|
||||
| :--------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **`geth`** | Our main Ethereum CLI client. It is the entry point into the Ethereum network (main-, test- or private net), capable of running as a full node (default), archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Ethereum network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` and the [CLI page](https://geth.ethereum.org/docs/fundamentals/command-line-options) for command line options. |
|
||||
| `clef` | Stand-alone signing tool, which can be used as a backend signer for `geth`. |
|
||||
| `devp2p` | Utilities to interact with nodes on the networking layer, without running a full blockchain. |
|
||||
| `abigen` | Source code generator to convert Ethereum contract definitions into easy-to-use, compile-time type-safe Go packages. It operates on plain [Ethereum contract ABIs](https://docs.soliditylang.org/en/develop/abi-spec.html) with expanded functionality if the contract bytecode is also available. However, it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://geth.ethereum.org/docs/developers/dapp-developer/native-bindings) page for details. |
|
||||
| `evm` | Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow isolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug run`). |
|
||||
|
|
@ -162,7 +162,7 @@ accessible from the outside.
|
|||
|
||||
As a developer, sooner rather than later you'll want to start interacting with `geth` and the
|
||||
Ethereum network via your own programs and not manually through the console. To aid
|
||||
this, `geth` has built-in support for a JSON-RPC based APIs ([standard APIs](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
||||
this, `geth` has built-in support for a JSON-RPC based APIs ([standard APIs](https://ethereum.github.io/execution-apis/api-documentation/)
|
||||
and [`geth` specific APIs](https://geth.ethereum.org/docs/interacting-with-geth/rpc)).
|
||||
These can be exposed via HTTP, WebSockets and IPC (UNIX sockets on UNIX based
|
||||
platforms, and named pipes on Windows).
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Audit reports are published in the `docs` folder: https://github.com/ethereum/go
|
|||
| Scope | Date | Report Link |
|
||||
| ------- | ------- | ----------- |
|
||||
| `geth` | 20170425 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2017-04-25_Geth-audit_Truesec.pdf) |
|
||||
| `clef` | 20180914 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2018-09-14_Clef-audit_NCC.pdf) |
|
||||
| `Discv5` | 20191015 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2019-10-15_Discv5_audit_LeastAuthority.pdf) |
|
||||
| `Discv5` | 20200124 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2020-01-24_DiscV5_audit_Cure53.pdf) |
|
||||
|
||||
|
|
@ -20,6 +21,7 @@ Audit reports are published in the `docs` folder: https://github.com/ethereum/go
|
|||
|
||||
To find out how to disclose a vulnerability in Ethereum visit [https://bounty.ethereum.org](https://bounty.ethereum.org) or email bounty@ethereum.org. Please read the [disclosure page](https://github.com/ethereum/go-ethereum/security/advisories?state=published) for more information about publicly disclosed security vulnerabilities.
|
||||
|
||||
Use the built-in `geth version-check` feature to check whether the software is affected by any known vulnerability. This command will fetch the latest [`vulnerabilities.json`](https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json) file which contains known security vulnerabilities concerning `geth`, and cross-check the data against its own version number.
|
||||
|
||||
The following key may be used to communicate sensitive information to developers.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
var (
|
||||
intRegex = regexp.MustCompile(`(u)?int([0-9]*)`)
|
||||
)
|
||||
|
||||
func isKeyWord(arg string) bool {
|
||||
switch arg {
|
||||
case "break":
|
||||
|
|
@ -303,7 +299,7 @@ func bindBasicType(kind abi.Type) string {
|
|||
case abi.AddressTy:
|
||||
return "common.Address"
|
||||
case abi.IntTy, abi.UintTy:
|
||||
parts := intRegex.FindStringSubmatch(kind.String())
|
||||
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String())
|
||||
switch parts[2] {
|
||||
case "8", "16", "32", "64":
|
||||
return fmt.Sprintf("%sint%s", parts[1], parts[2])
|
||||
|
|
|
|||
|
|
@ -485,13 +485,13 @@ var bindTests = []struct {
|
|||
contract Defaulter {
|
||||
address public caller;
|
||||
|
||||
fallback() external payable {
|
||||
function() {
|
||||
caller = msg.sender;
|
||||
}
|
||||
}
|
||||
`,
|
||||
[]string{`608060405234801561000f575f80fd5b5061013d8061001d5f395ff3fe608060405260043610610021575f3560e01c8063fc9c8d391461006257610022565b5b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055005b34801561006d575f80fd5b5061007661008c565b60405161008391906100ee565b60405180910390f35b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100d8826100af565b9050919050565b6100e8816100ce565b82525050565b5f6020820190506101015f8301846100df565b9291505056fea26469706673582212201e9273ecfb1f534644c77f09a25c21baaba81cf1c444ebc071e12a225a23c72964736f6c63430008140033`},
|
||||
[]string{`[{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"caller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]`},
|
||||
[]string{`6060604052606a8060106000396000f360606040523615601d5760e060020a6000350463fc9c8d3981146040575b605e6000805473ffffffffffffffffffffffffffffffffffffffff191633179055565b606060005473ffffffffffffffffffffffffffffffffffffffff1681565b005b6060908152602090f3`},
|
||||
[]string{`[{"constant":true,"inputs":[],"name":"caller","outputs":[{"name":"","type":"address"}],"type":"function"}]`},
|
||||
`
|
||||
"math/big"
|
||||
|
||||
|
|
@ -939,7 +939,6 @@ var bindTests = []struct {
|
|||
if _, err := eventer.RaiseSimpleEvent(auth, common.Address{byte(j)}, [32]byte{byte(j)}, true, big.NewInt(int64(10*i+j))); err != nil {
|
||||
t.Fatalf("block %d, event %d: raise failed: %v", i, j, err)
|
||||
}
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
}
|
||||
sim.Commit()
|
||||
}
|
||||
|
|
@ -1496,7 +1495,7 @@ var bindTests = []struct {
|
|||
if n != 3 {
|
||||
t.Fatalf("Invalid bar0 event")
|
||||
}
|
||||
case <-time.NewTimer(10 * time.Second).C:
|
||||
case <-time.NewTimer(3 * time.Second).C:
|
||||
t.Fatalf("Wait bar0 event timeout")
|
||||
}
|
||||
|
||||
|
|
@ -1507,7 +1506,7 @@ var bindTests = []struct {
|
|||
if n != 1 {
|
||||
t.Fatalf("Invalid bar event")
|
||||
}
|
||||
case <-time.NewTimer(10 * time.Second).C:
|
||||
case <-time.NewTimer(3 * time.Second).C:
|
||||
t.Fatalf("Wait bar event timeout")
|
||||
}
|
||||
close(stopCh)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@
|
|||
package {{.Package}}
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
"strings"
|
||||
"time"
|
||||
"errors"
|
||||
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
|
|
@ -29,8 +27,6 @@ var (
|
|||
_ = types.BloomLookup
|
||||
_ = event.NewSubscription
|
||||
_ = abi.ConvertType
|
||||
_ = time.Tick
|
||||
_ = context.Background
|
||||
)
|
||||
|
||||
{{$structs := .Structs}}
|
||||
|
|
@ -81,11 +77,7 @@ var (
|
|||
return common.Address{}, nil, nil, errors.New("GetABI returned nil")
|
||||
}
|
||||
{{range $pattern, $name := .Libraries}}
|
||||
{{decapitalise $name}}Addr, tx, _, _ := Deploy{{capitalise $name}}(auth, backend)
|
||||
ctx, _ := context.WithTimeout(context.Background(), 5 * time.Second)
|
||||
if err := bind.WaitAccepted(ctx, backend, tx); err != nil {
|
||||
return common.Address{}, nil, nil, err
|
||||
}
|
||||
{{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend)
|
||||
{{$contract.Type}}Bin = strings.ReplaceAll({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:])
|
||||
{{end}}
|
||||
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
|
||||
|
|
|
|||
|
|
@ -59,11 +59,6 @@ var (
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *{{.Type}}) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// New{{.Type}} creates a new instance of {{.Type}}.
|
||||
func New{{.Type}}() *{{.Type}} {
|
||||
parsed, err := {{.Type}}MetaData.ParseABI()
|
||||
|
|
@ -95,8 +90,7 @@ 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}}. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x{{printf "%x" .Original.ID}}.
|
||||
//
|
||||
// Solidity: {{.Original.String}}
|
||||
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
|
||||
|
|
@ -107,15 +101,6 @@ 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 }}
|
||||
|
|
@ -148,7 +133,8 @@ var (
|
|||
outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
return *outstruct, nil{{else}}
|
||||
return *outstruct, err
|
||||
{{else}}
|
||||
if err != nil {
|
||||
return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err
|
||||
}
|
||||
|
|
@ -159,8 +145,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}} nil
|
||||
{{- end}}
|
||||
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err
|
||||
{{- end}}
|
||||
}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
@ -188,11 +174,8 @@ var (
|
|||
// Solidity: {{.Original.String}}
|
||||
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Event(log *types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) {
|
||||
event := "{{.Original.Name}}"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != {{ decapitalise $contract.Type}}.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new({{$contract.Type}}{{.Normalized.Name}})
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type CallbackParam struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *CallbackParam) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewCallbackParam creates a new instance of CallbackParam.
|
||||
func NewCallbackParam() *CallbackParam {
|
||||
parsed, err := CallbackParamMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd7a5aba2.
|
||||
//
|
||||
// Solidity: function test(function callback) returns()
|
||||
func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
|
||||
|
|
@ -68,12 +62,3 @@ 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)
|
||||
}
|
||||
|
|
|
|||
121
accounts/abi/abigen/testdata/v2/crowdsale.go.txt
vendored
121
accounts/abi/abigen/testdata/v2/crowdsale.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Crowdsale struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Crowdsale) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewCrowdsale creates a new instance of Crowdsale.
|
||||
func NewCrowdsale() *Crowdsale {
|
||||
parsed, err := CrowdsaleMetaData.ParseABI()
|
||||
|
|
@ -69,8 +64,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x7b3e5e7b.
|
||||
//
|
||||
// Solidity: function amountRaised() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackAmountRaised() []byte {
|
||||
|
|
@ -81,15 +75,6 @@ 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.
|
||||
//
|
||||
|
|
@ -100,12 +85,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackBeneficiary is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x38af3eed. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x38af3eed.
|
||||
//
|
||||
// Solidity: function beneficiary() returns(address)
|
||||
func (crowdsale *Crowdsale) PackBeneficiary() []byte {
|
||||
|
|
@ -116,15 +100,6 @@ 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.
|
||||
//
|
||||
|
|
@ -135,12 +110,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01cb3b20. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x01cb3b20.
|
||||
//
|
||||
// Solidity: function checkGoalReached() returns()
|
||||
func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
|
||||
|
|
@ -151,18 +125,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x29dcb0cf.
|
||||
//
|
||||
// Solidity: function deadline() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackDeadline() []byte {
|
||||
|
|
@ -173,15 +137,6 @@ 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.
|
||||
//
|
||||
|
|
@ -192,12 +147,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackFunders is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc0d3dff. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xdc0d3dff.
|
||||
//
|
||||
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
|
||||
func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
|
||||
|
|
@ -208,15 +162,6 @@ 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 {
|
||||
|
|
@ -236,12 +181,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackFundingGoal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7a3a0e84. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x7a3a0e84.
|
||||
//
|
||||
// Solidity: function fundingGoal() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackFundingGoal() []byte {
|
||||
|
|
@ -252,15 +197,6 @@ 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.
|
||||
//
|
||||
|
|
@ -271,12 +207,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackPrice is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa035b1fe. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xa035b1fe.
|
||||
//
|
||||
// Solidity: function price() returns(uint256)
|
||||
func (crowdsale *Crowdsale) PackPrice() []byte {
|
||||
|
|
@ -287,15 +222,6 @@ 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.
|
||||
//
|
||||
|
|
@ -306,12 +232,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackTokenReward is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6e66f6e9. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x6e66f6e9.
|
||||
//
|
||||
// Solidity: function tokenReward() returns(address)
|
||||
func (crowdsale *Crowdsale) PackTokenReward() []byte {
|
||||
|
|
@ -322,15 +247,6 @@ 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.
|
||||
//
|
||||
|
|
@ -341,7 +257,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract.
|
||||
|
|
@ -365,11 +281,8 @@ func (CrowdsaleFundTransfer) ContractEventName() string {
|
|||
// Solidity: event FundTransfer(address backer, uint256 amount, bool isContribution)
|
||||
func (crowdsale *Crowdsale) UnpackFundTransferEvent(log *types.Log) (*CrowdsaleFundTransfer, error) {
|
||||
event := "FundTransfer"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != crowdsale.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(CrowdsaleFundTransfer)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
236
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
236
accounts/abi/abigen/testdata/v2/dao.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type DAO struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *DAO) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewDAO creates a new instance of DAO.
|
||||
func NewDAO() *DAO {
|
||||
parsed, err := DAOMetaData.ParseABI()
|
||||
|
|
@ -69,8 +64,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x9644fcbd.
|
||||
//
|
||||
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
|
||||
func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte {
|
||||
|
|
@ -81,18 +75,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xbcca1fd3.
|
||||
//
|
||||
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
|
||||
func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte {
|
||||
|
|
@ -103,18 +87,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xeceb2945.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -125,15 +99,6 @@ 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.
|
||||
//
|
||||
|
|
@ -144,12 +109,11 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x69bd3436. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x69bd3436.
|
||||
//
|
||||
// Solidity: function debatingPeriodInMinutes() returns(uint256)
|
||||
func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
|
||||
|
|
@ -160,15 +124,6 @@ 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.
|
||||
//
|
||||
|
|
@ -179,12 +134,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackExecuteProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x237e9492. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x237e9492.
|
||||
//
|
||||
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
|
||||
func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte {
|
||||
|
|
@ -195,15 +149,6 @@ 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.
|
||||
//
|
||||
|
|
@ -214,12 +159,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackMajorityMargin is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaa02a90f. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xaa02a90f.
|
||||
//
|
||||
// Solidity: function majorityMargin() returns(int256)
|
||||
func (dAO *DAO) PackMajorityMargin() []byte {
|
||||
|
|
@ -230,15 +174,6 @@ 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.
|
||||
//
|
||||
|
|
@ -249,12 +184,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackMemberId is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x39106821. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x39106821.
|
||||
//
|
||||
// Solidity: function memberId(address ) returns(uint256)
|
||||
func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
|
||||
|
|
@ -265,15 +199,6 @@ 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.
|
||||
//
|
||||
|
|
@ -284,12 +209,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackMembers is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5daf08ca. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x5daf08ca.
|
||||
//
|
||||
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
|
||||
func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
|
||||
|
|
@ -300,15 +224,6 @@ 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 {
|
||||
|
|
@ -332,12 +247,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackMinimumQuorum is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8160f0b5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x8160f0b5.
|
||||
//
|
||||
// Solidity: function minimumQuorum() returns(uint256)
|
||||
func (dAO *DAO) PackMinimumQuorum() []byte {
|
||||
|
|
@ -348,15 +263,6 @@ 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.
|
||||
//
|
||||
|
|
@ -367,12 +273,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackNewProposal is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xb1050da5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xb1050da5.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -383,15 +288,6 @@ 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.
|
||||
//
|
||||
|
|
@ -402,12 +298,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackNumProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x400e3949. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x400e3949.
|
||||
//
|
||||
// Solidity: function numProposals() returns(uint256)
|
||||
func (dAO *DAO) PackNumProposals() []byte {
|
||||
|
|
@ -418,15 +313,6 @@ 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.
|
||||
//
|
||||
|
|
@ -437,12 +323,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackOwner is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8da5cb5b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x8da5cb5b.
|
||||
//
|
||||
// Solidity: function owner() returns(address)
|
||||
func (dAO *DAO) PackOwner() []byte {
|
||||
|
|
@ -453,15 +338,6 @@ 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.
|
||||
//
|
||||
|
|
@ -472,12 +348,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackProposals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x013cf08b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x013cf08b.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -488,15 +363,6 @@ 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 {
|
||||
|
|
@ -530,12 +396,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackTransferOwnership is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf2fde38b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xf2fde38b.
|
||||
//
|
||||
// Solidity: function transferOwnership(address newOwner) returns()
|
||||
func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
|
||||
|
|
@ -546,18 +412,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd3c0715b.
|
||||
//
|
||||
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
|
||||
func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte {
|
||||
|
|
@ -568,15 +424,6 @@ 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.
|
||||
//
|
||||
|
|
@ -587,7 +434,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract.
|
||||
|
|
@ -611,11 +458,8 @@ func (DAOChangeOfRules) ContractEventName() string {
|
|||
// Solidity: event ChangeOfRules(uint256 minimumQuorum, uint256 debatingPeriodInMinutes, int256 majorityMargin)
|
||||
func (dAO *DAO) UnpackChangeOfRulesEvent(log *types.Log) (*DAOChangeOfRules, error) {
|
||||
event := "ChangeOfRules"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dAO.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DAOChangeOfRules)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -656,11 +500,8 @@ func (DAOMembershipChanged) ContractEventName() string {
|
|||
// Solidity: event MembershipChanged(address member, bool isMember)
|
||||
func (dAO *DAO) UnpackMembershipChangedEvent(log *types.Log) (*DAOMembershipChanged, error) {
|
||||
event := "MembershipChanged"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dAO.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DAOMembershipChanged)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -703,11 +544,8 @@ func (DAOProposalAdded) ContractEventName() string {
|
|||
// Solidity: event ProposalAdded(uint256 proposalID, address recipient, uint256 amount, string description)
|
||||
func (dAO *DAO) UnpackProposalAddedEvent(log *types.Log) (*DAOProposalAdded, error) {
|
||||
event := "ProposalAdded"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dAO.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DAOProposalAdded)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -750,11 +588,8 @@ func (DAOProposalTallied) ContractEventName() string {
|
|||
// Solidity: event ProposalTallied(uint256 proposalID, int256 result, uint256 quorum, bool active)
|
||||
func (dAO *DAO) UnpackProposalTalliedEvent(log *types.Log) (*DAOProposalTallied, error) {
|
||||
event := "ProposalTallied"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dAO.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DAOProposalTallied)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -797,11 +632,8 @@ func (DAOVoted) ContractEventName() string {
|
|||
// Solidity: event Voted(uint256 proposalID, bool position, address voter, string justification)
|
||||
func (dAO *DAO) UnpackVotedEvent(log *types.Log) (*DAOVoted, error) {
|
||||
event := "Voted"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dAO.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DAOVoted)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type DeeplyNestedArray struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *DeeplyNestedArray) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewDeeplyNestedArray creates a new instance of DeeplyNestedArray.
|
||||
func NewDeeplyNestedArray() *DeeplyNestedArray {
|
||||
parsed, err := DeeplyNestedArrayMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x98ed1856.
|
||||
//
|
||||
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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.
|
||||
//
|
||||
|
|
@ -88,12 +73,11 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) (
|
|||
return *new(uint64), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x8ed4573a. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x8ed4573a.
|
||||
//
|
||||
// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5])
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte {
|
||||
|
|
@ -104,15 +88,6 @@ 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.
|
||||
//
|
||||
|
|
@ -123,12 +98,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x34424855. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x34424855.
|
||||
//
|
||||
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
|
||||
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte {
|
||||
|
|
@ -138,12 +112,3 @@ 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)
|
||||
}
|
||||
|
|
|
|||
5
accounts/abi/abigen/testdata/v2/empty.go.txt
vendored
5
accounts/abi/abigen/testdata/v2/empty.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Empty struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Empty) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewEmpty creates a new instance of Empty.
|
||||
func NewEmpty() *Empty {
|
||||
parsed, err := EmptyMetaData.ParseABI()
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@ type EventChecker struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *EventChecker) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewEventChecker creates a new instance of EventChecker.
|
||||
func NewEventChecker() *EventChecker {
|
||||
parsed, err := EventCheckerMetaData.ParseABI()
|
||||
|
|
@ -77,11 +72,8 @@ func (EventCheckerDynamic) ContractEventName() string {
|
|||
// Solidity: event dynamic(string indexed idxStr, bytes indexed idxDat, string str, bytes dat)
|
||||
func (eventChecker *EventChecker) UnpackDynamicEvent(log *types.Log) (*EventCheckerDynamic, error) {
|
||||
event := "dynamic"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != eventChecker.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(EventCheckerDynamic)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -120,11 +112,8 @@ func (EventCheckerEmpty) ContractEventName() string {
|
|||
// Solidity: event empty()
|
||||
func (eventChecker *EventChecker) UnpackEmptyEvent(log *types.Log) (*EventCheckerEmpty, error) {
|
||||
event := "empty"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != eventChecker.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(EventCheckerEmpty)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -165,11 +154,8 @@ func (EventCheckerIndexed) ContractEventName() string {
|
|||
// Solidity: event indexed(address indexed addr, int256 indexed num)
|
||||
func (eventChecker *EventChecker) UnpackIndexedEvent(log *types.Log) (*EventCheckerIndexed, error) {
|
||||
event := "indexed"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != eventChecker.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(EventCheckerIndexed)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -210,11 +196,8 @@ func (EventCheckerMixed) ContractEventName() string {
|
|||
// Solidity: event mixed(address indexed addr, int256 num)
|
||||
func (eventChecker *EventChecker) UnpackMixedEvent(log *types.Log) (*EventCheckerMixed, error) {
|
||||
event := "mixed"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != eventChecker.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(EventCheckerMixed)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -255,11 +238,8 @@ func (EventCheckerUnnamed) ContractEventName() string {
|
|||
// Solidity: event unnamed(uint256 indexed arg0, uint256 indexed arg1)
|
||||
func (eventChecker *EventChecker) UnpackUnnamedEvent(log *types.Log) (*EventCheckerUnnamed, error) {
|
||||
event := "unnamed"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != eventChecker.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(EventCheckerUnnamed)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
20
accounts/abi/abigen/testdata/v2/getter.go.txt
vendored
20
accounts/abi/abigen/testdata/v2/getter.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Getter struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Getter) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewGetter creates a new instance of Getter.
|
||||
func NewGetter() *Getter {
|
||||
parsed, err := GetterMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x993a04b7.
|
||||
//
|
||||
// Solidity: function getter() returns(string, int256, bytes32)
|
||||
func (getter *Getter) PackGetter() []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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 {
|
||||
|
|
@ -99,5 +84,6 @@ 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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type IdentifierCollision struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *IdentifierCollision) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewIdentifierCollision creates a new instance of IdentifierCollision.
|
||||
func NewIdentifierCollision() *IdentifierCollision {
|
||||
parsed, err := IdentifierCollisionMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x4ef1f0ad.
|
||||
//
|
||||
// Solidity: function MyVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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.
|
||||
//
|
||||
|
|
@ -88,12 +73,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackPubVar is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x01ad4d87. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x01ad4d87.
|
||||
//
|
||||
// Solidity: function _myVar() view returns(uint256)
|
||||
func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
|
||||
|
|
@ -104,15 +88,6 @@ 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.
|
||||
//
|
||||
|
|
@ -123,5 +98,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@ type InputChecker struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *InputChecker) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewInputChecker creates a new instance of InputChecker.
|
||||
func NewInputChecker() *InputChecker {
|
||||
parsed, err := InputCheckerMetaData.ParseABI()
|
||||
|
|
@ -56,8 +51,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x3e708e82.
|
||||
//
|
||||
// Solidity: function anonInput(string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
|
||||
|
|
@ -68,18 +62,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x28160527.
|
||||
//
|
||||
// Solidity: function anonInputs(string , string ) returns()
|
||||
func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte {
|
||||
|
|
@ -90,18 +74,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xc689ebdc.
|
||||
//
|
||||
// Solidity: function mixedInputs(string , string str) returns()
|
||||
func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte {
|
||||
|
|
@ -112,18 +86,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x0d402005.
|
||||
//
|
||||
// Solidity: function namedInput(string str) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
|
||||
|
|
@ -134,18 +98,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x63c796ed.
|
||||
//
|
||||
// Solidity: function namedInputs(string str1, string str2) returns()
|
||||
func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte {
|
||||
|
|
@ -156,18 +110,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x53539029.
|
||||
//
|
||||
// Solidity: function noInput() returns()
|
||||
func (inputChecker *InputChecker) PackNoInput() []byte {
|
||||
|
|
@ -177,12 +121,3 @@ 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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type Interactor struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Interactor) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewInteractor creates a new instance of Interactor.
|
||||
func NewInteractor() *Interactor {
|
||||
parsed, err := InteractorMetaData.ParseABI()
|
||||
|
|
@ -69,8 +64,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x6874e809.
|
||||
//
|
||||
// Solidity: function deployString() returns(string)
|
||||
func (interactor *Interactor) PackDeployString() []byte {
|
||||
|
|
@ -81,15 +75,6 @@ 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.
|
||||
//
|
||||
|
|
@ -100,12 +85,11 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackTransact is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd736c513. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd736c513.
|
||||
//
|
||||
// Solidity: function transact(string str) returns()
|
||||
func (interactor *Interactor) PackTransact(str string) []byte {
|
||||
|
|
@ -116,18 +100,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x0d86a0e1.
|
||||
//
|
||||
// Solidity: function transactString() returns(string)
|
||||
func (interactor *Interactor) PackTransactString() []byte {
|
||||
|
|
@ -138,15 +112,6 @@ 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.
|
||||
//
|
||||
|
|
@ -157,5 +122,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error)
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ type NameConflict struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *NameConflict) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewNameConflict creates a new instance of NameConflict.
|
||||
func NewNameConflict() *NameConflict {
|
||||
parsed, err := NameConflictMetaData.ParseABI()
|
||||
|
|
@ -63,8 +58,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xcce7b048.
|
||||
//
|
||||
// Solidity: function addRequest((bytes,bytes) req) pure returns()
|
||||
func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
|
||||
|
|
@ -75,18 +69,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xc2bb515f.
|
||||
//
|
||||
// Solidity: function getRequest() pure returns((bytes,bytes))
|
||||
func (nameConflict *NameConflict) PackGetRequest() []byte {
|
||||
|
|
@ -97,15 +81,6 @@ 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.
|
||||
//
|
||||
|
|
@ -116,7 +91,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest,
|
|||
return *new(Oraclerequest), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// NameConflictLog represents a log event raised by the NameConflict contract.
|
||||
|
|
@ -139,11 +114,8 @@ func (NameConflictLog) ContractEventName() string {
|
|||
// Solidity: event log(int256 msg, int256 _msg)
|
||||
func (nameConflict *NameConflict) UnpackLogEvent(log *types.Log) (*NameConflictLog, error) {
|
||||
event := "log"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != nameConflict.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(NameConflictLog)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type NumericMethodName struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *NumericMethodName) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewNumericMethodName creates a new instance of NumericMethodName.
|
||||
func NewNumericMethodName() *NumericMethodName {
|
||||
parsed, err := NumericMethodNameMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xffa02795.
|
||||
//
|
||||
// Solidity: function _1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE1test() []byte {
|
||||
|
|
@ -69,18 +63,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd02767c7.
|
||||
//
|
||||
// Solidity: function __1test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE1test0() []byte {
|
||||
|
|
@ -91,18 +75,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x9d993132.
|
||||
//
|
||||
// Solidity: function __2test() pure returns()
|
||||
func (numericMethodName *NumericMethodName) PackE2test() []byte {
|
||||
|
|
@ -113,15 +87,6 @@ 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
|
||||
|
|
@ -141,11 +106,8 @@ func (NumericMethodNameE1TestEvent) ContractEventName() string {
|
|||
// Solidity: event _1TestEvent(address _param)
|
||||
func (numericMethodName *NumericMethodName) UnpackE1TestEventEvent(log *types.Log) (*NumericMethodNameE1TestEvent, error) {
|
||||
event := "_1TestEvent"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != numericMethodName.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(NumericMethodNameE1TestEvent)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
105
accounts/abi/abigen/testdata/v2/outputchecker.go.txt
vendored
105
accounts/abi/abigen/testdata/v2/outputchecker.go.txt
vendored
|
|
@ -35,11 +35,6 @@ type OutputChecker struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *OutputChecker) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewOutputChecker creates a new instance of OutputChecker.
|
||||
func NewOutputChecker() *OutputChecker {
|
||||
parsed, err := OutputCheckerMetaData.ParseABI()
|
||||
|
|
@ -56,8 +51,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x008bda05.
|
||||
//
|
||||
// Solidity: function anonOutput() returns(string)
|
||||
func (outputChecker *OutputChecker) PackAnonOutput() []byte {
|
||||
|
|
@ -68,15 +62,6 @@ 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.
|
||||
//
|
||||
|
|
@ -87,12 +72,11 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackAnonOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x3c401115. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x3c401115.
|
||||
//
|
||||
// Solidity: function anonOutputs() returns(string, string)
|
||||
func (outputChecker *OutputChecker) PackAnonOutputs() []byte {
|
||||
|
|
@ -103,15 +87,6 @@ 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 {
|
||||
|
|
@ -131,12 +106,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackCollidingOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xeccbc1ee. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xeccbc1ee.
|
||||
//
|
||||
// Solidity: function collidingOutputs() returns(string str, string Str)
|
||||
func (outputChecker *OutputChecker) PackCollidingOutputs() []byte {
|
||||
|
|
@ -147,15 +122,6 @@ 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 {
|
||||
|
|
@ -175,12 +141,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackMixedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x21b77b44. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x21b77b44.
|
||||
//
|
||||
// Solidity: function mixedOutputs() returns(string, string str)
|
||||
func (outputChecker *OutputChecker) PackMixedOutputs() []byte {
|
||||
|
|
@ -191,15 +157,6 @@ 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 {
|
||||
|
|
@ -219,12 +176,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackNamedOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x5e632bd5. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x5e632bd5.
|
||||
//
|
||||
// Solidity: function namedOutput() returns(string str)
|
||||
func (outputChecker *OutputChecker) PackNamedOutput() []byte {
|
||||
|
|
@ -235,15 +192,6 @@ 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.
|
||||
//
|
||||
|
|
@ -254,12 +202,11 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackNamedOutputs is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x7970a189. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x7970a189.
|
||||
//
|
||||
// Solidity: function namedOutputs() returns(string str1, string str2)
|
||||
func (outputChecker *OutputChecker) PackNamedOutputs() []byte {
|
||||
|
|
@ -270,15 +217,6 @@ 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 {
|
||||
|
|
@ -298,12 +236,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackNoOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x625f0306. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x625f0306.
|
||||
//
|
||||
// Solidity: function noOutput() returns()
|
||||
func (outputChecker *OutputChecker) PackNoOutput() []byte {
|
||||
|
|
@ -313,12 +251,3 @@ 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")
|
||||
}
|
||||
|
|
|
|||
39
accounts/abi/abigen/testdata/v2/overload.go.txt
vendored
39
accounts/abi/abigen/testdata/v2/overload.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Overload struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Overload) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewOverload creates a new instance of Overload.
|
||||
func NewOverload() *Overload {
|
||||
parsed, err := OverloadMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x04bc52f8.
|
||||
//
|
||||
// Solidity: function foo(uint256 i, uint256 j) returns()
|
||||
func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
|
||||
|
|
@ -69,18 +63,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2fbebd38.
|
||||
//
|
||||
// Solidity: function foo(uint256 i) returns()
|
||||
func (overload *Overload) PackFoo0(i *big.Int) []byte {
|
||||
|
|
@ -91,15 +75,6 @@ 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
|
||||
|
|
@ -119,11 +94,8 @@ func (OverloadBar) ContractEventName() string {
|
|||
// Solidity: event bar(uint256 i)
|
||||
func (overload *Overload) UnpackBarEvent(log *types.Log) (*OverloadBar, error) {
|
||||
event := "bar"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != overload.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(OverloadBar)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -164,11 +136,8 @@ func (OverloadBar0) ContractEventName() string {
|
|||
// Solidity: event bar(uint256 i, uint256 j)
|
||||
func (overload *Overload) UnpackBar0Event(log *types.Log) (*OverloadBar0, error) {
|
||||
event := "bar0"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != overload.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(OverloadBar0)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type RangeKeyword struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *RangeKeyword) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewRangeKeyword creates a new instance of RangeKeyword.
|
||||
func NewRangeKeyword() *RangeKeyword {
|
||||
parsed, err := RangeKeywordMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x527a119f.
|
||||
//
|
||||
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
|
||||
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte {
|
||||
|
|
@ -68,12 +62,3 @@ 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)
|
||||
}
|
||||
|
|
|
|||
61
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
61
accounts/abi/abigen/testdata/v2/slicer.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Slicer struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Slicer) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewSlicer creates a new instance of Slicer.
|
||||
func NewSlicer() *Slicer {
|
||||
parsed, err := SlicerMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xbe1127a3.
|
||||
//
|
||||
// Solidity: function echoAddresses(address[] input) returns(address[] output)
|
||||
func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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.
|
||||
//
|
||||
|
|
@ -88,12 +73,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackEchoBools is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xf637e589. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xf637e589.
|
||||
//
|
||||
// Solidity: function echoBools(bool[] input) returns(bool[] output)
|
||||
func (slicer *Slicer) PackEchoBools(input []bool) []byte {
|
||||
|
|
@ -104,15 +88,6 @@ 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.
|
||||
//
|
||||
|
|
@ -123,12 +98,11 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
|
|||
return *new([]bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackEchoFancyInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd88becc0. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd88becc0.
|
||||
//
|
||||
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
|
||||
func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
|
||||
|
|
@ -139,15 +113,6 @@ 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.
|
||||
//
|
||||
|
|
@ -158,12 +123,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackEchoInts is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe15a3db7. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe15a3db7.
|
||||
//
|
||||
// Solidity: function echoInts(int256[] input) returns(int256[] output)
|
||||
func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
|
||||
|
|
@ -174,15 +138,6 @@ 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.
|
||||
//
|
||||
|
|
@ -193,5 +148,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
116
accounts/abi/abigen/testdata/v2/structs-abi.go.txt
vendored
Normal file
116
accounts/abi/abigen/testdata/v2/structs-abi.go.txt
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
// Code generated via abigen V2 - DO NOT EDIT.
|
||||
// This file is a generated binding and any manual changes will be lost.
|
||||
|
||||
package v1bindtests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var (
|
||||
_ = bytes.Equal
|
||||
_ = errors.New
|
||||
_ = big.NewInt
|
||||
_ = common.Big1
|
||||
_ = types.BloomLookup
|
||||
_ = abi.ConvertType
|
||||
)
|
||||
|
||||
// Struct0 is an auto generated low-level Go binding around an user-defined struct.
|
||||
type Struct0 struct {
|
||||
B [32]byte
|
||||
}
|
||||
|
||||
// StructsMetaData contains all meta data concerning the Structs contract.
|
||||
var StructsMetaData = bind.MetaData{
|
||||
ABI: "[{\"inputs\":[],\"name\":\"F\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"B\",\"type\":\"bytes32\"}],\"internalType\":\"structStructs.A[]\",\"name\":\"a\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256[]\",\"name\":\"c\",\"type\":\"uint256[]\"},{\"internalType\":\"bool[]\",\"name\":\"d\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"G\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"B\",\"type\":\"bytes32\"}],\"internalType\":\"structStructs.A[]\",\"name\":\"a\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
|
||||
ID: "Structs",
|
||||
}
|
||||
|
||||
// Structs is an auto generated Go binding around an Ethereum contract.
|
||||
type Structs struct {
|
||||
abi abi.ABI
|
||||
}
|
||||
|
||||
// NewStructs creates a new instance of Structs.
|
||||
func NewStructs() *Structs {
|
||||
parsed, err := StructsMetaData.ParseABI()
|
||||
if err != nil {
|
||||
panic(errors.New("invalid ABI: " + err.Error()))
|
||||
}
|
||||
return &Structs{abi: *parsed}
|
||||
}
|
||||
|
||||
// Instance creates a wrapper for a deployed contract instance at the given address.
|
||||
<<<<<<< HEAD
|
||||
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
|
||||
func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
|
||||
return bind.NewBoundContract(addr, c.abi, backend, backend, backend)
|
||||
=======
|
||||
// Use this to create the instance object passed to abigen v2 library functions Call,
|
||||
// Transact, etc.
|
||||
func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) bind.BoundContract {
|
||||
return bind.NewBoundContract(backend, addr, c.abi)
|
||||
>>>>>>> 854c25e086 (accounts/abi/abigen: improve v2 template)
|
||||
}
|
||||
|
||||
// F is the Go binding used to pack the parameters required for calling
|
||||
// the contract method 0x28811f59.
|
||||
//
|
||||
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
|
||||
func (structs *Structs) PackF() ([]byte, error) {
|
||||
return structs.abi.Pack("F")
|
||||
}
|
||||
|
||||
// FOutput serves as a container for the return parameters of contract
|
||||
// method F.
|
||||
type FOutput struct {
|
||||
A []Struct0
|
||||
C []*big.Int
|
||||
D []bool
|
||||
}
|
||||
|
||||
// UnpackF is the Go binding that unpacks the parameters returned
|
||||
// from invoking the contract method with ID 0x28811f59.
|
||||
//
|
||||
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
|
||||
func (structs *Structs) UnpackF(data []byte) (*FOutput, error) {
|
||||
out, err := structs.abi.Unpack("F", data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret := new(FOutput)
|
||||
ret.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
|
||||
ret.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int)
|
||||
ret.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool)
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// G is the Go binding used to pack the parameters required for calling
|
||||
// the contract method 0x6fecb623.
|
||||
//
|
||||
// Solidity: function G() view returns((bytes32)[] a)
|
||||
func (structs *Structs) PackG() ([]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.
|
||||
//
|
||||
// Solidity: function G() view returns((bytes32)[] a)
|
||||
func (structs *Structs) UnpackG(data []byte) (*[]Struct0, error) {
|
||||
out, err := structs.abi.Unpack("G", data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
|
||||
return &out0, nil
|
||||
}
|
||||
34
accounts/abi/abigen/testdata/v2/structs.go.txt
vendored
34
accounts/abi/abigen/testdata/v2/structs.go.txt
vendored
|
|
@ -41,11 +41,6 @@ type Structs struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Structs) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewStructs creates a new instance of Structs.
|
||||
func NewStructs() *Structs {
|
||||
parsed, err := StructsMetaData.ParseABI()
|
||||
|
|
@ -62,8 +57,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x28811f59.
|
||||
//
|
||||
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
|
||||
func (structs *Structs) PackF() []byte {
|
||||
|
|
@ -74,15 +68,6 @@ 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 {
|
||||
|
|
@ -104,12 +89,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackG is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fecb623. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x6fecb623.
|
||||
//
|
||||
// Solidity: function G() view returns((bytes32)[] a)
|
||||
func (structs *Structs) PackG() []byte {
|
||||
|
|
@ -120,15 +105,6 @@ 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.
|
||||
//
|
||||
|
|
@ -139,5 +115,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) {
|
|||
return *new([]Struct0), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
134
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
134
accounts/abi/abigen/testdata/v2/token.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Token struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Token) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewToken creates a new instance of Token.
|
||||
func NewToken() *Token {
|
||||
parsed, err := TokenMetaData.ParseABI()
|
||||
|
|
@ -69,8 +64,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xdd62ed3e.
|
||||
//
|
||||
// Solidity: function allowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
|
|
@ -81,15 +75,6 @@ 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.
|
||||
//
|
||||
|
|
@ -100,12 +85,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackApproveAndCall is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xcae9ca51. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xcae9ca51.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -116,15 +100,6 @@ 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.
|
||||
//
|
||||
|
|
@ -135,12 +110,11 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackBalanceOf is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x70a08231. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x70a08231.
|
||||
//
|
||||
// Solidity: function balanceOf(address ) returns(uint256)
|
||||
func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
|
||||
|
|
@ -151,15 +125,6 @@ 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.
|
||||
//
|
||||
|
|
@ -170,12 +135,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackDecimals is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x313ce567. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x313ce567.
|
||||
//
|
||||
// Solidity: function decimals() returns(uint8)
|
||||
func (token *Token) PackDecimals() []byte {
|
||||
|
|
@ -186,15 +150,6 @@ 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.
|
||||
//
|
||||
|
|
@ -205,12 +160,11 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) {
|
|||
return *new(uint8), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackName is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x06fdde03. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x06fdde03.
|
||||
//
|
||||
// Solidity: function name() returns(string)
|
||||
func (token *Token) PackName() []byte {
|
||||
|
|
@ -221,15 +175,6 @@ 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.
|
||||
//
|
||||
|
|
@ -240,12 +185,11 @@ func (token *Token) UnpackName(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackSpentAllowance is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xdc3080f2. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xdc3080f2.
|
||||
//
|
||||
// Solidity: function spentAllowance(address , address ) returns(uint256)
|
||||
func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte {
|
||||
|
|
@ -256,15 +200,6 @@ 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.
|
||||
//
|
||||
|
|
@ -275,12 +210,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackSymbol is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x95d89b41. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x95d89b41.
|
||||
//
|
||||
// Solidity: function symbol() returns(string)
|
||||
func (token *Token) PackSymbol() []byte {
|
||||
|
|
@ -291,15 +225,6 @@ 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.
|
||||
//
|
||||
|
|
@ -310,12 +235,11 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
|
|||
return *new(string), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(string)).(*string)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackTransfer is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xa9059cbb. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xa9059cbb.
|
||||
//
|
||||
// Solidity: function transfer(address _to, uint256 _value) returns()
|
||||
func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
|
||||
|
|
@ -326,18 +250,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x23b872dd.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -348,15 +262,6 @@ 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.
|
||||
//
|
||||
|
|
@ -367,7 +272,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) {
|
|||
return *new(bool), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// TokenTransfer represents a Transfer event raised by the Token contract.
|
||||
|
|
@ -391,11 +296,8 @@ func (TokenTransfer) ContractEventName() string {
|
|||
// Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
|
||||
func (token *Token) UnpackTransferEvent(log *types.Log) (*TokenTransfer, error) {
|
||||
event := "Transfer"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != token.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(TokenTransfer)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
54
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
54
accounts/abi/abigen/testdata/v2/tuple.go.txt
vendored
|
|
@ -61,11 +61,6 @@ type Tuple struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Tuple) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewTuple creates a new instance of Tuple.
|
||||
func NewTuple() *Tuple {
|
||||
parsed, err := TupleMetaData.ParseABI()
|
||||
|
|
@ -82,8 +77,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x443c79b4.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -94,15 +88,6 @@ 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 {
|
||||
|
|
@ -128,12 +113,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackFunc2 is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xd0062cdd. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xd0062cdd.
|
||||
//
|
||||
// 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 {
|
||||
|
|
@ -144,18 +129,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe4d9a43b.
|
||||
//
|
||||
// Solidity: function func3((uint16,uint16)[] ) pure returns()
|
||||
func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
|
||||
|
|
@ -166,15 +141,6 @@ 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
|
||||
|
|
@ -198,11 +164,8 @@ func (TupleTupleEvent) ContractEventName() string {
|
|||
// Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e)
|
||||
func (tuple *Tuple) UnpackTupleEventEvent(log *types.Log) (*TupleTupleEvent, error) {
|
||||
event := "TupleEvent"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != tuple.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(TupleTupleEvent)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -242,11 +205,8 @@ func (TupleTupleEvent2) ContractEventName() string {
|
|||
// Solidity: event TupleEvent2((uint8,uint8)[] arg0)
|
||||
func (tuple *Tuple) UnpackTupleEvent2Event(log *types.Log) (*TupleTupleEvent2, error) {
|
||||
event := "TupleEvent2"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != tuple.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(TupleTupleEvent2)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
20
accounts/abi/abigen/testdata/v2/tupler.go.txt
vendored
20
accounts/abi/abigen/testdata/v2/tupler.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Tupler struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Tupler) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewTupler creates a new instance of Tupler.
|
||||
func NewTupler() *Tupler {
|
||||
parsed, err := TuplerMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x3175aae2.
|
||||
//
|
||||
// Solidity: function tuple() returns(string a, int256 b, bytes32 c)
|
||||
func (tupler *Tupler) PackTuple() []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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 {
|
||||
|
|
@ -99,5 +84,6 @@ 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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
|
|
|||
124
accounts/abi/abigen/testdata/v2/underscorer.go.txt
vendored
124
accounts/abi/abigen/testdata/v2/underscorer.go.txt
vendored
|
|
@ -36,11 +36,6 @@ type Underscorer struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *Underscorer) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewUnderscorer creates a new instance of Underscorer.
|
||||
func NewUnderscorer() *Underscorer {
|
||||
parsed, err := UnderscorerMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xb564b34d.
|
||||
//
|
||||
// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __)
|
||||
func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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 {
|
||||
|
|
@ -97,12 +82,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe409ca45. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe409ca45.
|
||||
//
|
||||
// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res)
|
||||
func (underscorer *Underscorer) PackLowerLowerCollision() []byte {
|
||||
|
|
@ -113,15 +98,6 @@ 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 {
|
||||
|
|
@ -141,12 +117,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x03a59213. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x03a59213.
|
||||
//
|
||||
// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res)
|
||||
func (underscorer *Underscorer) PackLowerUpperCollision() []byte {
|
||||
|
|
@ -157,15 +133,6 @@ 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 {
|
||||
|
|
@ -185,12 +152,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x9df48485. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x9df48485.
|
||||
//
|
||||
// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res)
|
||||
func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte {
|
||||
|
|
@ -201,15 +168,6 @@ 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 {
|
||||
|
|
@ -229,12 +187,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x67e6633d. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x67e6633d.
|
||||
//
|
||||
// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string)
|
||||
func (underscorer *Underscorer) PackUnderscoredOutput() []byte {
|
||||
|
|
@ -245,15 +203,6 @@ 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 {
|
||||
|
|
@ -273,12 +222,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xaf7486ab. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xaf7486ab.
|
||||
//
|
||||
// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res)
|
||||
func (underscorer *Underscorer) PackUpperLowerCollision() []byte {
|
||||
|
|
@ -289,15 +238,6 @@ 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 {
|
||||
|
|
@ -317,12 +257,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe02ab24d. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe02ab24d.
|
||||
//
|
||||
// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res)
|
||||
func (underscorer *Underscorer) PackUpperUpperCollision() []byte {
|
||||
|
|
@ -333,15 +273,6 @@ 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 {
|
||||
|
|
@ -361,12 +292,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x46546dbe. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x46546dbe.
|
||||
//
|
||||
// Solidity: function _under_scored_func() view returns(int256 _int)
|
||||
func (underscorer *Underscorer) PackUnderScoredFunc() []byte {
|
||||
|
|
@ -377,15 +308,6 @@ 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.
|
||||
//
|
||||
|
|
@ -396,5 +318,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ func (arguments Arguments) UnpackIntoMap(v map[string]any, data []byte) error {
|
|||
// Copy performs the operation go format -> provided struct.
|
||||
func (arguments Arguments) Copy(v any, values []any) error {
|
||||
// make sure the passed value is arguments pointer
|
||||
if reflect.Pointer != reflect.ValueOf(v).Kind() {
|
||||
if reflect.Ptr != reflect.ValueOf(v).Kind() {
|
||||
return fmt.Errorf("abi: Unpack(non-pointer %T)", v)
|
||||
}
|
||||
if len(values) == 0 {
|
||||
|
|
@ -165,7 +165,7 @@ func (arguments Arguments) copyTuple(v any, marshalledValues []any) error {
|
|||
}
|
||||
case reflect.Slice, reflect.Array:
|
||||
if value.Len() < len(marshalledValues) {
|
||||
return fmt.Errorf("abi: insufficient number of arguments for unpack, want %d, got %d", len(marshalledValues), value.Len())
|
||||
return fmt.Errorf("abi: insufficient number of arguments for unpack, want %d, got %d", len(arguments), value.Len())
|
||||
}
|
||||
for i := range nonIndexedArgs {
|
||||
if err := set(value.Index(i), reflect.ValueOf(marshalledValues[i])); err != nil {
|
||||
|
|
|
|||
|
|
@ -176,13 +176,6 @@ var (
|
|||
// ErrNoCodeAfterDeploy is returned by WaitDeployed if contract creation leaves
|
||||
// an empty contract behind.
|
||||
ErrNoCodeAfterDeploy = bind2.ErrNoCodeAfterDeploy
|
||||
|
||||
// ErrNoEventSignature is returned when a log entry has no topics.
|
||||
ErrNoEventSignature = bind2.ErrNoEventSignature
|
||||
|
||||
// ErrEventSignatureMismatch is returned when a log's topic[0] does not match
|
||||
// the expected event signature.
|
||||
ErrEventSignatureMismatch = bind2.ErrEventSignatureMismatch
|
||||
)
|
||||
|
||||
// ContractCaller defines the methods needed to allow operating with a contract on a read
|
||||
|
|
@ -273,12 +266,6 @@ func (m *MetaData) GetAbi() (*abi.ABI, error) {
|
|||
|
||||
// util.go
|
||||
|
||||
// WaitAccepted waits for a tx to be accepted into the pool.
|
||||
// It stops waiting when the context is canceled.
|
||||
func WaitAccepted(ctx context.Context, b ContractBackend, tx *types.Transaction) error {
|
||||
return bind2.WaitAccepted(ctx, b, tx.Hash())
|
||||
}
|
||||
|
||||
// WaitMined waits for tx to be mined on the blockchain.
|
||||
// It stops waiting when the context is canceled.
|
||||
func WaitMined(ctx context.Context, b DeployBackend, tx *types.Transaction) (*types.Receipt, error) {
|
||||
|
|
|
|||
|
|
@ -103,9 +103,6 @@ type ContractTransactor interface {
|
|||
|
||||
// PendingNonceAt retrieves the current pending nonce associated with an account.
|
||||
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
|
||||
|
||||
// TransactionByHash retrieves the transaction associated with the hash, if it exists in the pool.
|
||||
TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
|
||||
}
|
||||
|
||||
// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ import (
|
|||
const basefeeWiggleMultiplier = 2
|
||||
|
||||
var (
|
||||
ErrNoEventSignature = errors.New("no event signature")
|
||||
ErrEventSignatureMismatch = errors.New("event signature mismatch")
|
||||
errNoEventSignature = errors.New("no event signature")
|
||||
errEventSignatureMismatch = errors.New("event signature mismatch")
|
||||
)
|
||||
|
||||
// SignerFn is a signer function callback when a contract requires a method to
|
||||
|
|
@ -150,11 +150,6 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
|
|||
}
|
||||
}
|
||||
|
||||
// Address returns the deployment address of the contract.
|
||||
func (c *BoundContract) Address() common.Address {
|
||||
return c.address
|
||||
}
|
||||
|
||||
// Call invokes the (constant) contract method with params as input values and
|
||||
// sets the output to result. The result type might be a single field for simple
|
||||
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||
|
|
@ -277,10 +272,8 @@ func (c *BoundContract) RawCreationTransact(opts *TransactOpts, calldata []byte)
|
|||
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||
// its default method if one is available.
|
||||
func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) {
|
||||
// Check if payable fallback or receive is defined
|
||||
if !c.abi.HasReceive() && !(c.abi.HasFallback() && c.abi.Fallback.IsPayable()) {
|
||||
return nil, fmt.Errorf("contract does not have a payable fallback or receive function")
|
||||
}
|
||||
// todo(rjl493456442) check the payable fallback or receive is defined
|
||||
// or not, reject invalid transaction at the first place
|
||||
return c.transact(opts, &c.address, nil)
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +313,7 @@ func (c *BoundContract) createDynamicTx(opts *TransactOpts, contract *common.Add
|
|||
}
|
||||
}
|
||||
// create the transaction
|
||||
nonce, err := c.GetNonce(opts)
|
||||
nonce, err := c.getNonce(opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -365,7 +358,7 @@ func (c *BoundContract) createLegacyTx(opts *TransactOpts, contract *common.Addr
|
|||
}
|
||||
}
|
||||
// create the transaction
|
||||
nonce, err := c.GetNonce(opts)
|
||||
nonce, err := c.getNonce(opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -402,7 +395,7 @@ func (c *BoundContract) estimateGasLimit(opts *TransactOpts, contract *common.Ad
|
|||
return c.transactor.EstimateGas(ensureContext(opts.Context), msg)
|
||||
}
|
||||
|
||||
func (c *BoundContract) GetNonce(opts *TransactOpts) (uint64, error) {
|
||||
func (c *BoundContract) getNonce(opts *TransactOpts) (uint64, error) {
|
||||
if opts.Nonce == nil {
|
||||
return c.transactor.PendingNonceAt(ensureContext(opts.Context), opts.From)
|
||||
} else {
|
||||
|
|
@ -536,10 +529,10 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]any)
|
|||
func (c *BoundContract) UnpackLog(out any, event string, log types.Log) error {
|
||||
// Anonymous events are not supported.
|
||||
if len(log.Topics) == 0 {
|
||||
return ErrNoEventSignature
|
||||
return errNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != c.abi.Events[event].ID {
|
||||
return ErrEventSignatureMismatch
|
||||
return errEventSignatureMismatch
|
||||
}
|
||||
if len(log.Data) > 0 {
|
||||
if err := c.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
|
||||
|
|
@ -559,10 +552,10 @@ func (c *BoundContract) UnpackLog(out any, event string, log types.Log) error {
|
|||
func (c *BoundContract) UnpackLogIntoMap(out map[string]any, event string, log types.Log) error {
|
||||
// Anonymous events are not supported.
|
||||
if len(log.Topics) == 0 {
|
||||
return ErrNoEventSignature
|
||||
return errNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != c.abi.Events[event].ID {
|
||||
return ErrEventSignatureMismatch
|
||||
return errEventSignatureMismatch
|
||||
}
|
||||
if len(log.Data) > 0 {
|
||||
if err := c.abi.UnpackIntoMap(out, event, log.Data); err != nil {
|
||||
|
|
|
|||
|
|
@ -75,10 +75,6 @@ func (mt *mockTransactor) SendTransaction(ctx context.Context, tx *types.Transac
|
|||
return nil
|
||||
}
|
||||
|
||||
func (mt *mockTransactor) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error) {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
type mockCaller struct {
|
||||
codeAtBlockNumber *big.Int
|
||||
callContractBlockNumber *big.Int
|
||||
|
|
|
|||
|
|
@ -158,10 +158,10 @@ func testLinkCase(tcInput linkTestCaseInput) error {
|
|||
overrideAddrs = make(map[rune]common.Address)
|
||||
)
|
||||
// generate deterministic addresses for the override set.
|
||||
rng := rand.New(rand.NewSource(42))
|
||||
rand.Seed(42)
|
||||
for contract := range tcInput.overrides {
|
||||
var addr common.Address
|
||||
rng.Read(addr[:])
|
||||
rand.Read(addr[:])
|
||||
overrideAddrs[contract] = addr
|
||||
overridesAddrs[addr] = struct{}{}
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@ func TestContractLinking(t *testing.T) {
|
|||
map[rune]struct{}{},
|
||||
},
|
||||
// two contracts ('a' and 'f') share some dependencies. contract 'a' is marked as an override. expect that any of
|
||||
// its dependencies that aren't shared with 'f' are not deployed.
|
||||
// its depdencies that aren't shared with 'f' are not deployed.
|
||||
linkTestCaseInput{map[rune][]rune{
|
||||
'a': {'b', 'c', 'd', 'e'},
|
||||
'f': {'g', 'c', 'd', 'h'}},
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@ type DB struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *DB) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewDB creates a new instance of DB.
|
||||
func NewDB() *DB {
|
||||
parsed, err := DBMetaData.ParseABI()
|
||||
|
|
@ -64,8 +59,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x9507d39a.
|
||||
//
|
||||
// Solidity: function get(uint256 k) returns(uint256)
|
||||
func (dB *DB) PackGet(k *big.Int) []byte {
|
||||
|
|
@ -76,15 +70,6 @@ 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.
|
||||
//
|
||||
|
|
@ -95,12 +80,11 @@ 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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xe369ba3b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe369ba3b.
|
||||
//
|
||||
// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
|
||||
func (dB *DB) PackGetNamedStatParams() []byte {
|
||||
|
|
@ -111,15 +95,6 @@ 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 {
|
||||
|
|
@ -141,12 +116,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackGetStatParams is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x6fcb9c70. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x6fcb9c70.
|
||||
//
|
||||
// Solidity: function getStatParams() view returns(uint256, uint256, uint256)
|
||||
func (dB *DB) PackGetStatParams() []byte {
|
||||
|
|
@ -157,15 +132,6 @@ 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 {
|
||||
|
|
@ -187,12 +153,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, nil
|
||||
return *outstruct, err
|
||||
|
||||
}
|
||||
|
||||
// PackGetStatsStruct is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0xee8161e0. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xee8161e0.
|
||||
//
|
||||
// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
|
||||
func (dB *DB) PackGetStatsStruct() []byte {
|
||||
|
|
@ -203,15 +169,6 @@ 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.
|
||||
//
|
||||
|
|
@ -222,12 +179,11 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
|
|||
return *new(DBStats), err
|
||||
}
|
||||
out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats)
|
||||
return out0, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// PackInsert is the Go binding used to pack the parameters required for calling
|
||||
// the contract method with ID 0x1d834a1b. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x1d834a1b.
|
||||
//
|
||||
// Solidity: function insert(uint256 k, uint256 v) returns(uint256)
|
||||
func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
|
||||
|
|
@ -238,15 +194,6 @@ 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.
|
||||
//
|
||||
|
|
@ -257,7 +204,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// DBInsert represents a Insert event raised by the DB contract.
|
||||
|
|
@ -281,11 +228,8 @@ func (DBInsert) ContractEventName() string {
|
|||
// Solidity: event Insert(uint256 key, uint256 value, uint256 length)
|
||||
func (dB *DB) UnpackInsertEvent(log *types.Log) (*DBInsert, error) {
|
||||
event := "Insert"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dB.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DBInsert)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -326,11 +270,8 @@ func (DBKeyedInsert) ContractEventName() string {
|
|||
// Solidity: event KeyedInsert(uint256 indexed key, uint256 value)
|
||||
func (dB *DB) UnpackKeyedInsertEvent(log *types.Log) (*DBKeyedInsert, error) {
|
||||
event := "KeyedInsert"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != dB.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(DBKeyedInsert)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type C struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *C) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewC creates a new instance of C.
|
||||
func NewC() *C {
|
||||
parsed, err := CMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xcb493749.
|
||||
//
|
||||
// Solidity: function EmitMulti() returns()
|
||||
func (c *C) PackEmitMulti() []byte {
|
||||
|
|
@ -69,18 +63,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xe8e49a71.
|
||||
//
|
||||
// Solidity: function EmitOne() returns()
|
||||
func (c *C) PackEmitOne() []byte {
|
||||
|
|
@ -91,15 +75,6 @@ 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
|
||||
|
|
@ -120,11 +95,8 @@ func (CBasic1) ContractEventName() string {
|
|||
// Solidity: event basic1(uint256 indexed id, uint256 data)
|
||||
func (c *C) UnpackBasic1Event(log *types.Log) (*CBasic1, error) {
|
||||
event := "basic1"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != c.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(CBasic1)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
@ -165,11 +137,8 @@ func (CBasic2) ContractEventName() string {
|
|||
// Solidity: event basic2(bool indexed flag, uint256 data)
|
||||
func (c *C) UnpackBasic2Event(log *types.Log) (*CBasic2, error) {
|
||||
event := "basic2"
|
||||
if len(log.Topics) == 0 {
|
||||
return nil, bind.ErrNoEventSignature
|
||||
}
|
||||
if log.Topics[0] != c.abi.Events[event].ID {
|
||||
return nil, bind.ErrEventSignatureMismatch
|
||||
return nil, errors.New("event signature mismatch")
|
||||
}
|
||||
out := new(CBasic2)
|
||||
if len(log.Data) > 0 {
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ type C1 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *C1) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewC1 creates a new instance of C1.
|
||||
func NewC1() *C1 {
|
||||
parsed, err := C1MetaData.ParseABI()
|
||||
|
|
@ -73,8 +68,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c1 *C1) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -85,15 +79,6 @@ 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.
|
||||
//
|
||||
|
|
@ -104,7 +89,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// C2MetaData contains all meta data concerning the C2 contract.
|
||||
|
|
@ -123,11 +108,6 @@ type C2 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *C2) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewC2 creates a new instance of C2.
|
||||
func NewC2() *C2 {
|
||||
parsed, err := C2MetaData.ParseABI()
|
||||
|
|
@ -156,8 +136,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256 res)
|
||||
func (c2 *C2) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -168,15 +147,6 @@ 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.
|
||||
//
|
||||
|
|
@ -187,7 +157,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L1MetaData contains all meta data concerning the L1 contract.
|
||||
|
|
@ -202,11 +172,6 @@ type L1 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L1) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL1 creates a new instance of L1.
|
||||
func NewL1() *L1 {
|
||||
parsed, err := L1MetaData.ParseABI()
|
||||
|
|
@ -223,8 +188,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l1 *L1) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -235,15 +199,6 @@ 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.
|
||||
//
|
||||
|
|
@ -254,7 +209,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L2MetaData contains all meta data concerning the L2 contract.
|
||||
|
|
@ -272,11 +227,6 @@ type L2 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L2) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL2 creates a new instance of L2.
|
||||
func NewL2() *L2 {
|
||||
parsed, err := L2MetaData.ParseABI()
|
||||
|
|
@ -293,8 +243,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2 *L2) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -305,15 +254,6 @@ 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.
|
||||
//
|
||||
|
|
@ -324,7 +264,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L2bMetaData contains all meta data concerning the L2b contract.
|
||||
|
|
@ -342,11 +282,6 @@ type L2b struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L2b) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL2b creates a new instance of L2b.
|
||||
func NewL2b() *L2b {
|
||||
parsed, err := L2bMetaData.ParseABI()
|
||||
|
|
@ -363,8 +298,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l2b *L2b) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -375,15 +309,6 @@ 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.
|
||||
//
|
||||
|
|
@ -394,7 +319,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L3MetaData contains all meta data concerning the L3 contract.
|
||||
|
|
@ -409,11 +334,6 @@ type L3 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L3) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL3 creates a new instance of L3.
|
||||
func NewL3() *L3 {
|
||||
parsed, err := L3MetaData.ParseABI()
|
||||
|
|
@ -430,8 +350,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l3 *L3) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -442,15 +361,6 @@ 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.
|
||||
//
|
||||
|
|
@ -461,7 +371,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L4MetaData contains all meta data concerning the L4 contract.
|
||||
|
|
@ -480,11 +390,6 @@ type L4 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L4) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL4 creates a new instance of L4.
|
||||
func NewL4() *L4 {
|
||||
parsed, err := L4MetaData.ParseABI()
|
||||
|
|
@ -501,8 +406,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4 *L4) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -513,15 +417,6 @@ 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.
|
||||
//
|
||||
|
|
@ -532,7 +427,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
||||
// L4bMetaData contains all meta data concerning the L4b contract.
|
||||
|
|
@ -550,11 +445,6 @@ type L4b struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *L4b) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewL4b creates a new instance of L4b.
|
||||
func NewL4b() *L4b {
|
||||
parsed, err := L4bMetaData.ParseABI()
|
||||
|
|
@ -571,8 +461,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0x2ad11272.
|
||||
//
|
||||
// Solidity: function Do(uint256 val) pure returns(uint256)
|
||||
func (l4b *L4b) PackDo(val *big.Int) []byte {
|
||||
|
|
@ -583,15 +472,6 @@ 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.
|
||||
//
|
||||
|
|
@ -602,5 +482,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type C struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *C) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewC creates a new instance of C.
|
||||
func NewC() *C {
|
||||
parsed, err := CMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xb0a378b0.
|
||||
//
|
||||
// Solidity: function Bar() pure returns()
|
||||
func (c *C) PackBar() []byte {
|
||||
|
|
@ -69,18 +63,8 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xbfb4ebcf.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c *C) PackFoo() []byte {
|
||||
|
|
@ -91,15 +75,6 @@ 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) {
|
||||
|
|
@ -178,11 +153,6 @@ type C2 struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *C2) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewC2 creates a new instance of C2.
|
||||
func NewC2() *C2 {
|
||||
parsed, err := C2MetaData.ParseABI()
|
||||
|
|
@ -199,8 +169,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xbfb4ebcf.
|
||||
//
|
||||
// Solidity: function Foo() pure returns()
|
||||
func (c2 *C2) PackFoo() []byte {
|
||||
|
|
@ -211,15 +180,6 @@ 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) {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ type MyContract struct {
|
|||
abi abi.ABI
|
||||
}
|
||||
|
||||
// GetABI returns the ABI associated with this contract binding.
|
||||
func (c *MyContract) GetABI() abi.ABI {
|
||||
return c.abi
|
||||
}
|
||||
|
||||
// NewMyContract creates a new instance of MyContract.
|
||||
func NewMyContract() *MyContract {
|
||||
parsed, err := MyContractMetaData.ParseABI()
|
||||
|
|
@ -57,8 +52,7 @@ 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. This method will panic if any
|
||||
// invalid/nil inputs are passed.
|
||||
// the contract method with ID 0xbd6d1007.
|
||||
//
|
||||
// Solidity: function GetNums() pure returns(uint256[5])
|
||||
func (myContract *MyContract) PackGetNums() []byte {
|
||||
|
|
@ -69,15 +63,6 @@ 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.
|
||||
//
|
||||
|
|
@ -88,5 +73,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, nil
|
||||
return out0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ package bind
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
|
|
@ -242,27 +241,3 @@ 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,14 +65,6 @@ 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) {
|
||||
|
|
@ -88,7 +80,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, makeTestDeployerWithNonceAssignment(bindBackend.Client))
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend.Client))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %+v\n", err)
|
||||
}
|
||||
|
|
@ -130,7 +122,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
|
|||
deploymentParams := &bind.DeploymentParams{
|
||||
Contracts: nested_libraries.C1MetaData.Deps,
|
||||
}
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend))
|
||||
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %+v\n", err)
|
||||
}
|
||||
|
|
@ -310,7 +302,7 @@ done:
|
|||
t.Fatalf("expected e1Count of 2 from filter call. got %d", e1Count)
|
||||
}
|
||||
if e2Count != 1 {
|
||||
t.Fatalf("expected e2Count of 1 from filter call. got %d", e2Count)
|
||||
t.Fatalf("expected e2Count of 1 from filter call. got %d", e1Count)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -367,28 +359,3 @@ func TestErrors(t *testing.T) {
|
|||
t.Fatalf("bad unpacked error result: expected Arg4 to be false. got true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEventUnpackEmptyTopics(t *testing.T) {
|
||||
c := events.NewC()
|
||||
|
||||
for _, log := range []*types.Log{
|
||||
{Topics: []common.Hash{}},
|
||||
{Topics: nil},
|
||||
} {
|
||||
_, err := c.UnpackBasic1Event(log)
|
||||
if err == nil {
|
||||
t.Fatal("expected error when unpacking event with empty topics, got nil")
|
||||
}
|
||||
if err != bind.ErrNoEventSignature {
|
||||
t.Fatalf("expected 'no event signature' error, got: %v", err)
|
||||
}
|
||||
|
||||
_, err = c.UnpackBasic2Event(log)
|
||||
if err == nil {
|
||||
t.Fatal("expected error when unpacking event with empty topics, got nil")
|
||||
}
|
||||
if err != bind.ErrNoEventSignature {
|
||||
t.Fatalf("expected 'no event signature' error, got: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,28 +75,3 @@ func WaitDeployed(ctx context.Context, b DeployBackend, hash common.Hash) (commo
|
|||
}
|
||||
return receipt.ContractAddress, err
|
||||
}
|
||||
|
||||
func WaitAccepted(ctx context.Context, d ContractBackend, txHash common.Hash) error {
|
||||
queryTicker := time.NewTicker(time.Second)
|
||||
defer queryTicker.Stop()
|
||||
logger := log.New("hash", txHash)
|
||||
for {
|
||||
_, _, err := d.TransactionByHash(ctx, txHash)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if errors.Is(err, ethereum.NotFound) { // TODO: check this is emitted
|
||||
logger.Trace("Transaction not yet accepted")
|
||||
} else {
|
||||
logger.Trace("Transaction submission failed", "err", err)
|
||||
}
|
||||
|
||||
// Wait for the next round.
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-queryTicker.C:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,29 +100,22 @@ func TestWaitDeployed(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestWaitDeployedCornerCases(t *testing.T) {
|
||||
var (
|
||||
backend = simulated.NewBackend(
|
||||
types.GenesisAlloc{
|
||||
crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)},
|
||||
},
|
||||
)
|
||||
head, _ = backend.Client().HeaderByNumber(t.Context(), nil) // Should be child's, good enough
|
||||
gasPrice = new(big.Int).Add(head.BaseFee, big.NewInt(1))
|
||||
signer = types.LatestSigner(params.AllDevChainProtocolChanges)
|
||||
code = common.FromHex("6060604052600a8060106000396000f360606040526008565b00")
|
||||
ctx, cancel = context.WithCancel(t.Context())
|
||||
backend := simulated.NewBackend(
|
||||
types.GenesisAlloc{
|
||||
crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)},
|
||||
},
|
||||
)
|
||||
defer backend.Close()
|
||||
|
||||
// 1. WaitDeploy on a transaction that does not deploy a contract, verify it
|
||||
// returns an error.
|
||||
tx := types.MustSignNewTx(testKey, signer, &types.LegacyTx{
|
||||
Nonce: 0,
|
||||
To: &common.Address{0x01},
|
||||
Gas: 300000,
|
||||
GasPrice: gasPrice,
|
||||
Data: code,
|
||||
})
|
||||
head, _ := backend.Client().HeaderByNumber(context.Background(), nil) // Should be child's, good enough
|
||||
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(1))
|
||||
|
||||
// Create a transaction to an account.
|
||||
code := "6060604052600a8060106000396000f360606040526008565b00"
|
||||
tx := types.NewTransaction(0, common.HexToAddress("0x01"), big.NewInt(0), 3000000, gasPrice, common.FromHex(code))
|
||||
tx, _ = types.SignTx(tx, types.LatestSigner(params.AllDevChainProtocolChanges), testKey)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
if err := backend.Client().SendTransaction(ctx, tx); err != nil {
|
||||
t.Errorf("failed to send transaction: %q", err)
|
||||
}
|
||||
|
|
@ -131,22 +124,14 @@ func TestWaitDeployedCornerCases(t *testing.T) {
|
|||
t.Errorf("error mismatch: want %q, got %q, ", bind.ErrNoAddressInReceipt, err)
|
||||
}
|
||||
|
||||
// 2. Create a contract, but cancel the WaitDeploy before it is mined.
|
||||
tx = types.MustSignNewTx(testKey, signer, &types.LegacyTx{
|
||||
Nonce: 1,
|
||||
Gas: 300000,
|
||||
GasPrice: gasPrice,
|
||||
Data: code,
|
||||
})
|
||||
// Create a transaction that is not mined.
|
||||
tx = types.NewContractCreation(1, big.NewInt(0), 3000000, gasPrice, common.FromHex(code))
|
||||
tx, _ = types.SignTx(tx, types.LatestSigner(params.AllDevChainProtocolChanges), testKey)
|
||||
|
||||
// Wait in another thread so that we can quickly cancel it after submitting
|
||||
// the transaction.
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
_, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash())
|
||||
if !errors.Is(err, context.Canceled) {
|
||||
t.Errorf("error mismatch: want %v, got %v", context.Canceled, err)
|
||||
contextCanceled := errors.New("context canceled")
|
||||
if _, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash()); err.Error() != contextCanceled.Error() {
|
||||
t.Errorf("error mismatch: want %q, got %q, ", contextCanceled, err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
@ -154,11 +139,4 @@ func TestWaitDeployedCornerCases(t *testing.T) {
|
|||
t.Errorf("failed to send transaction: %q", err)
|
||||
}
|
||||
cancel()
|
||||
|
||||
// Wait for goroutine to exit or for a timeout.
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(time.Second * 2):
|
||||
t.Fatalf("failed to cancel wait deploy")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,15 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
errBadBool = errors.New("abi: improperly encoded boolean value")
|
||||
errBadUint8 = errors.New("abi: improperly encoded uint8 value")
|
||||
errBadUint16 = errors.New("abi: improperly encoded uint16 value")
|
||||
errBadUint32 = errors.New("abi: improperly encoded uint32 value")
|
||||
errBadUint64 = errors.New("abi: improperly encoded uint64 value")
|
||||
errBadInt8 = errors.New("abi: improperly encoded int8 value")
|
||||
errBadInt16 = errors.New("abi: improperly encoded int16 value")
|
||||
errBadInt32 = errors.New("abi: improperly encoded int32 value")
|
||||
errBadInt64 = errors.New("abi: improperly encoded int64 value")
|
||||
errInvalidSign = errors.New("abi: negatively-signed value cannot be packed into uint parameter")
|
||||
errBadBool = errors.New("abi: improperly encoded boolean value")
|
||||
errBadUint8 = errors.New("abi: improperly encoded uint8 value")
|
||||
errBadUint16 = errors.New("abi: improperly encoded uint16 value")
|
||||
errBadUint32 = errors.New("abi: improperly encoded uint32 value")
|
||||
errBadUint64 = errors.New("abi: improperly encoded uint64 value")
|
||||
errBadInt8 = errors.New("abi: improperly encoded int8 value")
|
||||
errBadInt16 = errors.New("abi: improperly encoded int16 value")
|
||||
errBadInt32 = errors.New("abi: improperly encoded int32 value")
|
||||
errBadInt64 = errors.New("abi: improperly encoded int64 value")
|
||||
)
|
||||
|
||||
// formatSliceString formats the reflection kind with the given slice size
|
||||
|
|
|
|||
|
|
@ -37,16 +37,7 @@ func packBytesSlice(bytes []byte, l int) []byte {
|
|||
// t.
|
||||
func packElement(t Type, reflectValue reflect.Value) ([]byte, error) {
|
||||
switch t.T {
|
||||
case UintTy:
|
||||
// make sure to not pack a negative value into a uint type.
|
||||
if reflectValue.Kind() == reflect.Pointer {
|
||||
val := new(big.Int).Set(reflectValue.Interface().(*big.Int))
|
||||
if val.Sign() == -1 {
|
||||
return nil, errInvalidSign
|
||||
}
|
||||
}
|
||||
return packNum(reflectValue), nil
|
||||
case IntTy:
|
||||
case IntTy, UintTy:
|
||||
return packNum(reflectValue), nil
|
||||
case StringTy:
|
||||
return packBytesSlice([]byte(reflectValue.String()), reflectValue.Len()), nil
|
||||
|
|
@ -86,7 +77,7 @@ func packNum(value reflect.Value) []byte {
|
|||
return math.U256Bytes(new(big.Int).SetUint64(value.Uint()))
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return math.U256Bytes(big.NewInt(value.Int()))
|
||||
case reflect.Pointer:
|
||||
case reflect.Ptr:
|
||||
return math.U256Bytes(new(big.Int).Set(value.Interface().(*big.Int)))
|
||||
default:
|
||||
panic("abi: fatal error")
|
||||
|
|
|
|||
|
|
@ -177,11 +177,6 @@ func TestMethodPack(t *testing.T) {
|
|||
if !bytes.Equal(packed, sig) {
|
||||
t.Errorf("expected %x got %x", sig, packed)
|
||||
}
|
||||
|
||||
// test that we can't pack a negative value for a parameter that is specified as a uint
|
||||
if _, err := abi.Pack("send", big.NewInt(-1)); err == nil {
|
||||
t.Fatal("expected error when trying to pack negative big.Int into uint256 value")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackNumber(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func ConvertType(in interface{}, proto interface{}) interface{} {
|
|||
// indirect recursively dereferences the value until it either gets the value
|
||||
// or finds a big.Int
|
||||
func indirect(v reflect.Value) reflect.Value {
|
||||
if v.Kind() == reflect.Pointer && v.Elem().Type() != reflect.TypeFor[big.Int]() {
|
||||
if v.Kind() == reflect.Ptr && v.Elem().Type() != reflect.TypeOf(big.Int{}) {
|
||||
return indirect(v.Elem())
|
||||
}
|
||||
return v
|
||||
|
|
@ -65,32 +65,32 @@ func reflectIntType(unsigned bool, size int) reflect.Type {
|
|||
if unsigned {
|
||||
switch size {
|
||||
case 8:
|
||||
return reflect.TypeFor[uint8]()
|
||||
return reflect.TypeOf(uint8(0))
|
||||
case 16:
|
||||
return reflect.TypeFor[uint16]()
|
||||
return reflect.TypeOf(uint16(0))
|
||||
case 32:
|
||||
return reflect.TypeFor[uint32]()
|
||||
return reflect.TypeOf(uint32(0))
|
||||
case 64:
|
||||
return reflect.TypeFor[uint64]()
|
||||
return reflect.TypeOf(uint64(0))
|
||||
}
|
||||
}
|
||||
switch size {
|
||||
case 8:
|
||||
return reflect.TypeFor[int8]()
|
||||
return reflect.TypeOf(int8(0))
|
||||
case 16:
|
||||
return reflect.TypeFor[int16]()
|
||||
return reflect.TypeOf(int16(0))
|
||||
case 32:
|
||||
return reflect.TypeFor[int32]()
|
||||
return reflect.TypeOf(int32(0))
|
||||
case 64:
|
||||
return reflect.TypeFor[int64]()
|
||||
return reflect.TypeOf(int64(0))
|
||||
}
|
||||
return reflect.TypeFor[*big.Int]()
|
||||
return reflect.TypeOf(&big.Int{})
|
||||
}
|
||||
|
||||
// mustArrayToByteSlice creates a new byte slice with the exact same size as value
|
||||
// and copies the bytes in value to the new slice.
|
||||
func mustArrayToByteSlice(value reflect.Value) reflect.Value {
|
||||
slice := reflect.ValueOf(make([]byte, value.Len()))
|
||||
slice := reflect.MakeSlice(reflect.TypeOf([]byte{}), value.Len(), value.Len())
|
||||
reflect.Copy(slice, value)
|
||||
return slice
|
||||
}
|
||||
|
|
@ -102,9 +102,9 @@ func mustArrayToByteSlice(value reflect.Value) reflect.Value {
|
|||
func set(dst, src reflect.Value) error {
|
||||
dstType, srcType := dst.Type(), src.Type()
|
||||
switch {
|
||||
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Pointer || dst.Elem().CanSet()):
|
||||
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()):
|
||||
return set(dst.Elem(), src)
|
||||
case dstType.Kind() == reflect.Pointer && dstType.Elem() != reflect.TypeFor[big.Int]():
|
||||
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}):
|
||||
return set(dst.Elem(), src)
|
||||
case srcType.AssignableTo(dstType) && dst.CanSet():
|
||||
dst.Set(src)
|
||||
|
|
@ -138,7 +138,7 @@ func setSlice(dst, src reflect.Value) error {
|
|||
}
|
||||
|
||||
func setArray(dst, src reflect.Value) error {
|
||||
if src.Kind() == reflect.Pointer {
|
||||
if src.Kind() == reflect.Ptr {
|
||||
return set(dst, indirect(src))
|
||||
}
|
||||
array := reflect.New(dst.Type()).Elem()
|
||||
|
|
|
|||
|
|
@ -204,12 +204,12 @@ func TestConvertType(t *testing.T) {
|
|||
var fields []reflect.StructField
|
||||
fields = append(fields, reflect.StructField{
|
||||
Name: "X",
|
||||
Type: reflect.TypeFor[*big.Int](),
|
||||
Type: reflect.TypeOf(new(big.Int)),
|
||||
Tag: "json:\"" + "x" + "\"",
|
||||
})
|
||||
fields = append(fields, reflect.StructField{
|
||||
Name: "Y",
|
||||
Type: reflect.TypeFor[*big.Int](),
|
||||
Type: reflect.TypeOf(new(big.Int)),
|
||||
Tag: "json:\"" + "y" + "\"",
|
||||
})
|
||||
val := reflect.New(reflect.StructOf(fields))
|
||||
|
|
|
|||
|
|
@ -75,11 +75,8 @@ func parseElementaryType(unescapedSelector string) (string, string, error) {
|
|||
parsedType = parsedType + string(rest[0])
|
||||
rest = rest[1:]
|
||||
}
|
||||
if len(rest) == 0 {
|
||||
return "", "", fmt.Errorf("failed to parse array: expected ']', got end of string")
|
||||
}
|
||||
if rest[0] != ']' {
|
||||
return "", "", fmt.Errorf("failed to parse array: expected ']', got %c", rest[0])
|
||||
if len(rest) == 0 || rest[0] != ']' {
|
||||
return "", "", fmt.Errorf("failed to parse array: expected ']', got %c", unescapedSelector[0])
|
||||
}
|
||||
parsedType = parsedType + string(rest[0])
|
||||
rest = rest[1:]
|
||||
|
|
|
|||
|
|
@ -238,9 +238,9 @@ func (t Type) GetType() reflect.Type {
|
|||
case UintTy:
|
||||
return reflectIntType(true, t.Size)
|
||||
case BoolTy:
|
||||
return reflect.TypeFor[bool]()
|
||||
return reflect.TypeOf(false)
|
||||
case StringTy:
|
||||
return reflect.TypeFor[string]()
|
||||
return reflect.TypeOf("")
|
||||
case SliceTy:
|
||||
return reflect.SliceOf(t.Elem.GetType())
|
||||
case ArrayTy:
|
||||
|
|
@ -248,15 +248,19 @@ func (t Type) GetType() reflect.Type {
|
|||
case TupleTy:
|
||||
return t.TupleType
|
||||
case AddressTy:
|
||||
return reflect.TypeFor[common.Address]()
|
||||
return reflect.TypeOf(common.Address{})
|
||||
case FixedBytesTy:
|
||||
return reflect.ArrayOf(t.Size, reflect.TypeFor[byte]())
|
||||
return reflect.ArrayOf(t.Size, reflect.TypeOf(byte(0)))
|
||||
case BytesTy:
|
||||
return reflect.TypeFor[[]byte]()
|
||||
case HashTy, FixedPointTy: // currently not used
|
||||
return reflect.TypeFor[[32]byte]()
|
||||
return reflect.SliceOf(reflect.TypeOf(byte(0)))
|
||||
case HashTy:
|
||||
// hashtype currently not used
|
||||
return reflect.ArrayOf(32, reflect.TypeOf(byte(0)))
|
||||
case FixedPointTy:
|
||||
// fixedpoint type currently not used
|
||||
return reflect.ArrayOf(32, reflect.TypeOf(byte(0)))
|
||||
case FunctionTy:
|
||||
return reflect.TypeFor[[24]byte]()
|
||||
return reflect.ArrayOf(24, reflect.TypeOf(byte(0)))
|
||||
default:
|
||||
panic("Invalid type")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ func forEachUnpack(t Type, output []byte, start, size int) (interface{}, error)
|
|||
return nil, fmt.Errorf("cannot marshal input to array, size is negative (%d)", size)
|
||||
}
|
||||
if start+32*size > len(output) {
|
||||
return nil, fmt.Errorf("abi: cannot marshal into go array: offset %d would go over slice boundary (len=%d)", start+32*size, len(output))
|
||||
return nil, fmt.Errorf("abi: cannot marshal into go array: offset %d would go over slice boundary (len=%d)", len(output), start+32*size)
|
||||
}
|
||||
|
||||
// this value will become our slice or our array, depending on the type
|
||||
|
|
|
|||
|
|
@ -910,7 +910,7 @@ func TestUnpackTuple(t *testing.T) {
|
|||
},
|
||||
},
|
||||
FieldT: T{
|
||||
big.NewInt(0).SetBits([]big.Word{}), big.NewInt(1),
|
||||
big.NewInt(0), big.NewInt(1),
|
||||
},
|
||||
A: big.NewInt(1),
|
||||
}
|
||||
|
|
@ -919,7 +919,7 @@ func TestUnpackTuple(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !reflect.DeepEqual(ret, expected) {
|
||||
if reflect.DeepEqual(ret, expected) {
|
||||
t.Error("unexpected unpack value")
|
||||
}
|
||||
}
|
||||
|
|
@ -1014,134 +1014,128 @@ func TestPackAndUnpackIncompatibleNumber(t *testing.T) {
|
|||
cases := []struct {
|
||||
decodeType string
|
||||
inputValue *big.Int
|
||||
unpackErr error
|
||||
packErr error
|
||||
err error
|
||||
expectValue interface{}
|
||||
}{
|
||||
{
|
||||
decodeType: "uint8",
|
||||
inputValue: big.NewInt(math.MaxUint8 + 1),
|
||||
unpackErr: errBadUint8,
|
||||
err: errBadUint8,
|
||||
},
|
||||
{
|
||||
decodeType: "uint8",
|
||||
inputValue: big.NewInt(math.MaxUint8),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: uint8(math.MaxUint8),
|
||||
},
|
||||
{
|
||||
decodeType: "uint16",
|
||||
inputValue: big.NewInt(math.MaxUint16 + 1),
|
||||
unpackErr: errBadUint16,
|
||||
err: errBadUint16,
|
||||
},
|
||||
{
|
||||
decodeType: "uint16",
|
||||
inputValue: big.NewInt(math.MaxUint16),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: uint16(math.MaxUint16),
|
||||
},
|
||||
{
|
||||
decodeType: "uint32",
|
||||
inputValue: big.NewInt(math.MaxUint32 + 1),
|
||||
unpackErr: errBadUint32,
|
||||
err: errBadUint32,
|
||||
},
|
||||
{
|
||||
decodeType: "uint32",
|
||||
inputValue: big.NewInt(math.MaxUint32),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: uint32(math.MaxUint32),
|
||||
},
|
||||
{
|
||||
decodeType: "uint64",
|
||||
inputValue: maxU64Plus1,
|
||||
unpackErr: errBadUint64,
|
||||
err: errBadUint64,
|
||||
},
|
||||
{
|
||||
decodeType: "uint64",
|
||||
inputValue: maxU64,
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: uint64(math.MaxUint64),
|
||||
},
|
||||
{
|
||||
decodeType: "uint256",
|
||||
inputValue: maxU64Plus1,
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: maxU64Plus1,
|
||||
},
|
||||
{
|
||||
decodeType: "int8",
|
||||
inputValue: big.NewInt(math.MaxInt8 + 1),
|
||||
unpackErr: errBadInt8,
|
||||
err: errBadInt8,
|
||||
},
|
||||
{
|
||||
decodeType: "int8",
|
||||
inputValue: big.NewInt(math.MinInt8 - 1),
|
||||
packErr: errInvalidSign,
|
||||
err: errBadInt8,
|
||||
},
|
||||
{
|
||||
decodeType: "int8",
|
||||
inputValue: big.NewInt(math.MaxInt8),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: int8(math.MaxInt8),
|
||||
},
|
||||
{
|
||||
decodeType: "int16",
|
||||
inputValue: big.NewInt(math.MaxInt16 + 1),
|
||||
unpackErr: errBadInt16,
|
||||
err: errBadInt16,
|
||||
},
|
||||
{
|
||||
decodeType: "int16",
|
||||
inputValue: big.NewInt(math.MinInt16 - 1),
|
||||
packErr: errInvalidSign,
|
||||
err: errBadInt16,
|
||||
},
|
||||
{
|
||||
decodeType: "int16",
|
||||
inputValue: big.NewInt(math.MaxInt16),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: int16(math.MaxInt16),
|
||||
},
|
||||
{
|
||||
decodeType: "int32",
|
||||
inputValue: big.NewInt(math.MaxInt32 + 1),
|
||||
unpackErr: errBadInt32,
|
||||
err: errBadInt32,
|
||||
},
|
||||
{
|
||||
decodeType: "int32",
|
||||
inputValue: big.NewInt(math.MinInt32 - 1),
|
||||
packErr: errInvalidSign,
|
||||
err: errBadInt32,
|
||||
},
|
||||
{
|
||||
decodeType: "int32",
|
||||
inputValue: big.NewInt(math.MaxInt32),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: int32(math.MaxInt32),
|
||||
},
|
||||
{
|
||||
decodeType: "int64",
|
||||
inputValue: new(big.Int).Add(big.NewInt(math.MaxInt64), big.NewInt(1)),
|
||||
unpackErr: errBadInt64,
|
||||
err: errBadInt64,
|
||||
},
|
||||
{
|
||||
decodeType: "int64",
|
||||
inputValue: new(big.Int).Sub(big.NewInt(math.MinInt64), big.NewInt(1)),
|
||||
packErr: errInvalidSign,
|
||||
err: errBadInt64,
|
||||
},
|
||||
{
|
||||
decodeType: "int64",
|
||||
inputValue: big.NewInt(math.MaxInt64),
|
||||
unpackErr: nil,
|
||||
err: nil,
|
||||
expectValue: int64(math.MaxInt64),
|
||||
},
|
||||
}
|
||||
for i, testCase := range cases {
|
||||
packed, err := encodeABI.Pack(testCase.inputValue)
|
||||
if testCase.packErr != nil {
|
||||
if err == nil {
|
||||
t.Fatalf("expected packing of testcase input value to fail")
|
||||
}
|
||||
if err != testCase.packErr {
|
||||
t.Fatalf("expected error '%v', got '%v'", testCase.packErr, err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err != nil && err != testCase.packErr {
|
||||
panic(fmt.Errorf("unexpected error packing test-case input: %v", err))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ty, err := NewType(testCase.decodeType, "", nil)
|
||||
if err != nil {
|
||||
|
|
@ -1151,8 +1145,8 @@ func TestPackAndUnpackIncompatibleNumber(t *testing.T) {
|
|||
{Type: ty},
|
||||
}
|
||||
decoded, err := decodeABI.Unpack(packed)
|
||||
if err != testCase.unpackErr {
|
||||
t.Fatalf("Expected error %v, actual error %v. case %d", testCase.unpackErr, err, i)
|
||||
if err != testCase.err {
|
||||
t.Fatalf("Expected error %v, actual error %v. case %d", testCase.err, err, i)
|
||||
}
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import (
|
|||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto/keccak"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// Account represents an Ethereum account located at a specific location defined
|
||||
|
|
@ -196,7 +196,7 @@ func TextHash(data []byte) []byte {
|
|||
// This gives context to the signed message and prevents signing of transactions.
|
||||
func TextAndHash(data []byte) ([]byte, string) {
|
||||
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
|
||||
hasher := keccak.NewLegacyKeccak256()
|
||||
hasher := sha3.NewLegacyKeccak256()
|
||||
hasher.Write([]byte(msg))
|
||||
return hasher.Sum(nil), msg
|
||||
}
|
||||
|
|
|
|||
1
accounts/external/backend.go
vendored
1
accounts/external/backend.go
vendored
|
|
@ -237,7 +237,6 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
|
|||
}
|
||||
if tx.Type() == types.BlobTxType {
|
||||
args.BlobHashes = tx.BlobHashes()
|
||||
args.BlobFeeCap = (*hexutil.Big)(tx.BlobGasFeeCap())
|
||||
sidecar := tx.BlobTxSidecar()
|
||||
if sidecar == nil {
|
||||
return nil, errors.New("blobs must be present for signing")
|
||||
|
|
|
|||
|
|
@ -68,27 +68,18 @@ func waitWatcherStart(ks *KeyStore) bool {
|
|||
|
||||
func waitForAccounts(wantAccounts []accounts.Account, ks *KeyStore) error {
|
||||
var list []accounts.Account
|
||||
haveAccounts := false
|
||||
haveChange := false
|
||||
for t0 := time.Now(); time.Since(t0) < 5*time.Second; time.Sleep(100 * time.Millisecond) {
|
||||
if !haveAccounts {
|
||||
list = ks.Accounts()
|
||||
haveAccounts = reflect.DeepEqual(list, wantAccounts)
|
||||
}
|
||||
if !haveChange {
|
||||
list = ks.Accounts()
|
||||
if reflect.DeepEqual(list, wantAccounts) {
|
||||
// ks should have also received change notifications
|
||||
select {
|
||||
case <-ks.changes:
|
||||
haveChange = true
|
||||
default:
|
||||
return errors.New("wasn't notified of new accounts")
|
||||
}
|
||||
}
|
||||
if haveAccounts && haveChange {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if haveAccounts {
|
||||
return errors.New("wasn't notified of new accounts")
|
||||
}
|
||||
return fmt.Errorf("\ngot %v\nwant %v", list, wantAccounts)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ func toISO8601(t time.Time) string {
|
|||
if name == "UTC" {
|
||||
tz = "Z"
|
||||
} else {
|
||||
tz = fmt.Sprintf("%+03d00", offset/3600)
|
||||
tz = fmt.Sprintf("%03d00", offset/3600)
|
||||
}
|
||||
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s",
|
||||
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)
|
||||
|
|
|
|||
|
|
@ -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://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/ for more information.
|
||||
// See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information.
|
||||
package keystore
|
||||
|
||||
import (
|
||||
|
|
@ -50,7 +50,7 @@ var (
|
|||
)
|
||||
|
||||
// KeyStoreType is the reflect type of a keystore backend.
|
||||
var KeyStoreType = reflect.TypeFor[*KeyStore]()
|
||||
var KeyStoreType = reflect.TypeOf(&KeyStore{})
|
||||
|
||||
// KeyStoreScheme is the protocol scheme prefixing account and wallet URLs.
|
||||
const KeyStoreScheme = "keystore"
|
||||
|
|
@ -99,10 +99,9 @@ func (ks *KeyStore) init(keydir string) {
|
|||
// TODO: In order for this finalizer to work, there must be no references
|
||||
// to ks. addressCache doesn't keep a reference but unlocked keys do,
|
||||
// so the finalizer will not trigger until all timed unlocks have expired.
|
||||
runtime.AddCleanup(ks, func(c *accountCache) {
|
||||
c.close()
|
||||
}, ks.cache)
|
||||
|
||||
runtime.SetFinalizer(ks, func(m *KeyStore) {
|
||||
m.cache.close()
|
||||
})
|
||||
// Create the initial list of wallets from the cache
|
||||
accs := ks.cache.accounts()
|
||||
ks.wallets = make([]accounts.Wallet, len(accs))
|
||||
|
|
@ -196,14 +195,11 @@ func (ks *KeyStore) Subscribe(sink chan<- accounts.WalletEvent) event.Subscripti
|
|||
// forces a manual refresh (only triggers for systems where the filesystem notifier
|
||||
// is not running).
|
||||
func (ks *KeyStore) updater() {
|
||||
ticker := time.NewTicker(walletRefreshCycle)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
// Wait for an account update or a refresh timeout
|
||||
select {
|
||||
case <-ks.changes:
|
||||
case <-ticker.C:
|
||||
case <-time.After(walletRefreshCycle):
|
||||
}
|
||||
// Run the wallet refresher
|
||||
ks.refreshWallets()
|
||||
|
|
@ -418,7 +414,6 @@ func (ks *KeyStore) Export(a accounts.Account, passphrase, newPassphrase string)
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer zeroKey(key.PrivateKey)
|
||||
var N, P int
|
||||
if store, ok := ks.storage.(*keyStorePassphrase); ok {
|
||||
N, P = store.scryptN, store.scryptP
|
||||
|
|
@ -478,7 +473,6 @@ func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string)
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer zeroKey(key.PrivateKey)
|
||||
return ks.storage.StoreKey(a.URL.Path, key, newPassphrase)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/
|
||||
The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -81,9 +81,6 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error
|
|||
*/
|
||||
passBytes := []byte(password)
|
||||
derivedKey := pbkdf2.Key(passBytes, passBytes, 2000, 16, sha256.New)
|
||||
if len(cipherText)%aes.BlockSize != 0 {
|
||||
return nil, errors.New("ciphertext must be a multiple of block size")
|
||||
}
|
||||
plainText, err := aesCBCDecrypt(derivedKey, cipherText, iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
// 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/>.
|
||||
|
||||
//go:build (darwin && !ios && cgo) || freebsd || linux || netbsd || solaris
|
||||
// +build darwin,!ios,cgo freebsd linux netbsd solaris
|
||||
//go:build (darwin && !ios && cgo) || freebsd || (linux && !arm64) || netbsd || solaris
|
||||
// +build darwin,!ios,cgo freebsd linux,!arm64 netbsd solaris
|
||||
|
||||
package keystore
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
// 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/>.
|
||||
|
||||
//go:build (darwin && !cgo) || ios || windows || (!darwin && !freebsd && !linux && !netbsd && !solaris)
|
||||
// +build darwin,!cgo ios windows !darwin,!freebsd,!linux,!netbsd,!solaris
|
||||
//go:build (darwin && !cgo) || ios || (linux && arm64) || windows || (!darwin && !freebsd && !linux && !netbsd && !solaris)
|
||||
// +build darwin,!cgo ios linux,arm64 windows !darwin,!freebsd,!linux,!netbsd,!solaris
|
||||
|
||||
// This is the fallback implementation of directory watching.
|
||||
// It is used on unsupported platforms.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package accounts
|
|||
|
||||
import (
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
|
|
@ -94,6 +93,9 @@ func NewManager(config *Config, backends ...Backend) *Manager {
|
|||
|
||||
// Close terminates the account manager's internal notification processes.
|
||||
func (am *Manager) Close() error {
|
||||
for _, w := range am.wallets {
|
||||
w.Close()
|
||||
}
|
||||
errc := make(chan error)
|
||||
am.quit <- errc
|
||||
return <-errc
|
||||
|
|
@ -147,10 +149,6 @@ func (am *Manager) update() {
|
|||
am.lock.Unlock()
|
||||
close(event.processed)
|
||||
case errc := <-am.quit:
|
||||
// Close all owned wallets
|
||||
for _, w := range am.wallets {
|
||||
w.Close()
|
||||
}
|
||||
// Manager terminating, return
|
||||
errc <- nil
|
||||
// Signals event emitters the loop is not receiving values
|
||||
|
|
@ -255,12 +253,13 @@ func merge(slice []Wallet, wallets ...Wallet) []Wallet {
|
|||
// drop is the counterpart of merge, which looks up wallets from within the sorted
|
||||
// cache and removes the ones specified.
|
||||
func drop(slice []Wallet, wallets ...Wallet) []Wallet {
|
||||
remove := make(map[URL]struct{}, len(wallets))
|
||||
for _, w := range wallets {
|
||||
remove[w.URL()] = struct{}{}
|
||||
for _, wallet := range wallets {
|
||||
n := sort.Search(len(slice), func(i int) bool { return slice[i].URL().Cmp(wallet.URL()) >= 0 })
|
||||
if n == len(slice) {
|
||||
// Wallet not found, may happen during startup
|
||||
continue
|
||||
}
|
||||
slice = append(slice[:n], slice[n+1:]...)
|
||||
}
|
||||
return slices.DeleteFunc(slice, func(w Wallet) bool {
|
||||
_, ok := remove[w.URL()]
|
||||
return ok
|
||||
})
|
||||
return slice
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ func (hub *Hub) readPairings() error {
|
|||
}
|
||||
|
||||
func (hub *Hub) writePairings() error {
|
||||
pairingFile, err := os.OpenFile(filepath.Join(hub.datadir, "smartcards.json"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
|
||||
pairingFile, err := os.OpenFile(filepath.Join(hub.datadir, "smartcards.json"), os.O_RDWR|os.O_CREATE, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -129,8 +129,11 @@ func (hub *Hub) writePairings() error {
|
|||
return err
|
||||
}
|
||||
|
||||
_, err = pairingFile.Write(pairingData)
|
||||
return err
|
||||
if _, err := pairingFile.Write(pairingData); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (hub *Hub) pairing(wallet *Wallet) *smartcardPairing {
|
||||
|
|
|
|||
|
|
@ -300,10 +300,6 @@ func (s *SecureChannelSession) decryptAPDU(data []byte) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) == 0 || len(data)%aes.BlockSize != 0 {
|
||||
return nil, fmt.Errorf("invalid ciphertext length: %d", len(data))
|
||||
}
|
||||
|
||||
ret := make([]byte, len(data))
|
||||
|
||||
crypter := cipher.NewCBCDecrypter(a, s.iv)
|
||||
|
|
|
|||
|
|
@ -472,11 +472,6 @@ func (w *Wallet) selfDerive() {
|
|||
continue
|
||||
}
|
||||
pairing := w.Hub.pairing(w)
|
||||
if pairing == nil {
|
||||
w.lock.Unlock()
|
||||
reqc <- struct{}{}
|
||||
continue
|
||||
}
|
||||
|
||||
// Device lock obtained, derive the next batch of accounts
|
||||
var (
|
||||
|
|
@ -636,13 +631,13 @@ func (w *Wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
|
|||
}
|
||||
|
||||
if pin {
|
||||
if pairing := w.Hub.pairing(w); pairing != nil {
|
||||
pairing.Accounts[account.Address] = path
|
||||
if err := w.Hub.setPairing(w, pairing); err != nil {
|
||||
return accounts.Account{}, err
|
||||
}
|
||||
pairing := w.Hub.pairing(w)
|
||||
pairing.Accounts[account.Address] = path
|
||||
if err := w.Hub.setPairing(w, pairing); err != nil {
|
||||
return accounts.Account{}, err
|
||||
}
|
||||
}
|
||||
|
||||
return account, nil
|
||||
}
|
||||
|
||||
|
|
@ -779,11 +774,11 @@ func (w *Wallet) SignTxWithPassphrase(account accounts.Account, passphrase strin
|
|||
// It first checks for the address in the list of pinned accounts, and if it is
|
||||
// not found, attempts to parse the derivation path from the account's URL.
|
||||
func (w *Wallet) findAccountPath(account accounts.Account) (accounts.DerivationPath, error) {
|
||||
if pairing := w.Hub.pairing(w); pairing != nil {
|
||||
if path, ok := pairing.Accounts[account.Address]; ok {
|
||||
return path, nil
|
||||
}
|
||||
pairing := w.Hub.pairing(w)
|
||||
if path, ok := pairing.Accounts[account.Address]; ok {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
// Look for the path in the URL
|
||||
if account.URL.Scheme != w.Hub.scheme {
|
||||
return nil, fmt.Errorf("scheme %s does not match wallet scheme %s", account.URL.Scheme, w.Hub.scheme)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/hid"
|
||||
"github.com/karalabe/hid"
|
||||
)
|
||||
|
||||
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
|
||||
|
|
@ -43,14 +43,6 @@ const refreshCycle = time.Second
|
|||
// trashing.
|
||||
const refreshThrottling = 500 * time.Millisecond
|
||||
|
||||
const (
|
||||
// deviceUsagePage identifies Ledger devices by HID usage page (0xffa0) on Windows and macOS.
|
||||
// See: https://github.com/LedgerHQ/ledger-live/blob/05a2980e838955a11a1418da638ef8ac3df4fb74/libs/ledgerjs/packages/hw-transport-node-hid-noevents/src/TransportNodeHid.ts
|
||||
deviceUsagePage = 0xffa0
|
||||
// deviceInterface identifies Ledger devices by USB interface number (0) on Linux.
|
||||
deviceInterface = 0
|
||||
)
|
||||
|
||||
// Hub is a accounts.Backend that can find and handle generic USB hardware wallets.
|
||||
type Hub struct {
|
||||
scheme string // Protocol scheme prefixing account and wallet URLs.
|
||||
|
|
@ -90,7 +82,6 @@ func NewLedgerHub() (*Hub, error) {
|
|||
0x0005, /* Ledger Nano S Plus */
|
||||
0x0006, /* Ledger Nano FTS */
|
||||
0x0007, /* Ledger Flex */
|
||||
0x0008, /* Ledger Nano Gen5 */
|
||||
|
||||
0x0000, /* WebUSB Ledger Blue */
|
||||
0x1000, /* WebUSB Ledger Nano S */
|
||||
|
|
@ -98,8 +89,7 @@ func NewLedgerHub() (*Hub, error) {
|
|||
0x5000, /* WebUSB Ledger Nano S Plus */
|
||||
0x6000, /* WebUSB Ledger Nano FTS */
|
||||
0x7000, /* WebUSB Ledger Flex */
|
||||
0x8000, /* WebUSB Ledger Nano Gen5 */
|
||||
}, deviceUsagePage, deviceInterface, newLedgerDriver)
|
||||
}, 0xffa0, 0, newLedgerDriver)
|
||||
}
|
||||
|
||||
// NewTrezorHubWithHID creates a new hardware wallet manager for Trezor devices.
|
||||
|
|
|
|||
|
|
@ -110,16 +110,6 @@ func (w *ledgerDriver) offline() bool {
|
|||
return w.version == [3]byte{0, 0, 0}
|
||||
}
|
||||
|
||||
func ledgerVersionLessThan(version [3]byte, major, minor, patch byte) bool {
|
||||
if version[0] != major {
|
||||
return version[0] < major
|
||||
}
|
||||
if version[1] != minor {
|
||||
return version[1] < minor
|
||||
}
|
||||
return version[2] < patch
|
||||
}
|
||||
|
||||
// Open implements usbwallet.driver, attempting to initialize the connection to the
|
||||
// Ledger hardware wallet. The Ledger does not require a user passphrase, so that
|
||||
// parameter is silently discarded.
|
||||
|
|
@ -176,19 +166,7 @@ func (w *ledgerDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
|
|||
return common.Address{}, nil, accounts.ErrWalletClosed
|
||||
}
|
||||
// Ensure the wallet is capable of signing the given transaction
|
||||
switch tx.Type() {
|
||||
case types.AccessListTxType, types.DynamicFeeTxType:
|
||||
if ledgerVersionLessThan(w.version, 1, 9, 0) {
|
||||
//lint:ignore ST1005 brand name displayed on the console
|
||||
return common.Address{}, nil, fmt.Errorf("Ledger version >= 1.9.0 required for EIP-2930/EIP-1559 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2])
|
||||
}
|
||||
case types.SetCodeTxType:
|
||||
if ledgerVersionLessThan(w.version, 1, 17, 0) {
|
||||
//lint:ignore ST1005 brand name displayed on the console
|
||||
return common.Address{}, nil, fmt.Errorf("Ledger version >= 1.17.0 required for EIP-7702 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2])
|
||||
}
|
||||
}
|
||||
if chainID != nil && ledgerVersionLessThan(w.version, 1, 0, 3) {
|
||||
if chainID != nil && w.version[0] <= 1 && w.version[1] <= 0 && w.version[2] <= 2 {
|
||||
//lint:ignore ST1005 brand name displayed on the console
|
||||
return common.Address{}, nil, fmt.Errorf("Ledger v%d.%d.%d doesn't support signing this transaction, please update to v1.0.3 at least", w.version[0], w.version[1], w.version[2])
|
||||
}
|
||||
|
|
@ -206,7 +184,7 @@ func (w *ledgerDriver) SignTypedMessage(path accounts.DerivationPath, domainHash
|
|||
return nil, accounts.ErrWalletClosed
|
||||
}
|
||||
// Ensure the wallet is capable of signing the given transaction
|
||||
if ledgerVersionLessThan(w.version, 1, 5, 0) {
|
||||
if w.version[0] < 1 && w.version[1] < 5 {
|
||||
//lint:ignore ST1005 brand name displayed on the console
|
||||
return nil, fmt.Errorf("Ledger version >= 1.5.0 required for EIP-712 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2])
|
||||
}
|
||||
|
|
@ -356,41 +334,26 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
|
|||
err error
|
||||
)
|
||||
if chainID == nil {
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data()}); err != nil {
|
||||
if txrlp, err = rlp.EncodeToBytes([]interface{}{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data()}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
} else {
|
||||
switch tx.Type() {
|
||||
case types.SetCodeTxType:
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations()}); err != nil {
|
||||
if tx.Type() == types.DynamicFeeTxType {
|
||||
if txrlp, err = rlp.EncodeToBytes([]interface{}{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
// append type to transaction
|
||||
txrlp = append([]byte{tx.Type()}, txrlp...)
|
||||
case types.BlobTxType:
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList(), tx.BlobGasFeeCap(), tx.BlobHashes()}); err != nil {
|
||||
} else if tx.Type() == types.AccessListTxType {
|
||||
if txrlp, err = rlp.EncodeToBytes([]interface{}{chainID, tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
// append type to transaction
|
||||
txrlp = append([]byte{tx.Type()}, txrlp...)
|
||||
case types.DynamicFeeTxType:
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
|
||||
} else if tx.Type() == types.LegacyTxType {
|
||||
if txrlp, err = rlp.EncodeToBytes([]interface{}{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), chainID, big.NewInt(0), big.NewInt(0)}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
// append type to transaction
|
||||
txrlp = append([]byte{tx.Type()}, txrlp...)
|
||||
case types.AccessListTxType:
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{chainID, tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
// append type to transaction
|
||||
txrlp = append([]byte{tx.Type()}, txrlp...)
|
||||
case types.LegacyTxType:
|
||||
if txrlp, err = rlp.EncodeToBytes([]any{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), chainID, big.NewInt(0), big.NewInt(0)}); err != nil {
|
||||
return common.Address{}, nil, err
|
||||
}
|
||||
default:
|
||||
return common.Address{}, nil, fmt.Errorf("unsupported transaction type: %d", tx.Type())
|
||||
}
|
||||
}
|
||||
payload := append(path, txrlp...)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/hid"
|
||||
"github.com/karalabe/hid"
|
||||
)
|
||||
|
||||
// Maximum time between wallet health checks to detect USB unplugs.
|
||||
|
|
@ -632,7 +632,7 @@ func (w *wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID
|
|||
// data is not supported for Ledger wallets, so this method will always return
|
||||
// an error.
|
||||
func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
|
||||
return w.SignText(account, text)
|
||||
return w.SignText(account, accounts.TextHash(text))
|
||||
}
|
||||
|
||||
// SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given
|
||||
|
|
|
|||
59
appveyor.yml
Normal file
59
appveyor.yml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
clone_depth: 5
|
||||
version: "{branch}.{build}"
|
||||
|
||||
image:
|
||||
- Ubuntu
|
||||
- Visual Studio 2019
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- GETH_ARCH: amd64
|
||||
GETH_MINGW: 'C:\msys64\mingw64'
|
||||
- GETH_ARCH: 386
|
||||
GETH_MINGW: 'C:\msys64\mingw32'
|
||||
|
||||
install:
|
||||
- git submodule update --init --depth 1 --recursive
|
||||
- go version
|
||||
|
||||
for:
|
||||
# Linux has its own script without -arch and -cc.
|
||||
# The linux builder also runs lint.
|
||||
- matrix:
|
||||
only:
|
||||
- image: Ubuntu
|
||||
build_script:
|
||||
- go run build/ci.go lint
|
||||
- go run build/ci.go check_generate
|
||||
- go run build/ci.go check_baddeps
|
||||
- go run build/ci.go install -dlgo
|
||||
test_script:
|
||||
- go run build/ci.go test -dlgo -short
|
||||
|
||||
# linux/386 is disabled.
|
||||
- matrix:
|
||||
exclude:
|
||||
- image: Ubuntu
|
||||
GETH_ARCH: 386
|
||||
|
||||
# Windows builds for amd64 + 386.
|
||||
- matrix:
|
||||
only:
|
||||
- image: Visual Studio 2019
|
||||
environment:
|
||||
# We use gcc from MSYS2 because it is the most recent compiler version available on
|
||||
# AppVeyor. Note: gcc.exe only works properly if the corresponding bin/ directory is
|
||||
# contained in PATH.
|
||||
GETH_CC: '%GETH_MINGW%\bin\gcc.exe'
|
||||
PATH: '%GETH_MINGW%\bin;C:\Program Files (x86)\NSIS\;%PATH%'
|
||||
build_script:
|
||||
- 'echo %GETH_ARCH%'
|
||||
- 'echo %GETH_CC%'
|
||||
- '%GETH_CC% --version'
|
||||
- go run build/ci.go install -dlgo -arch %GETH_ARCH% -cc %GETH_CC%
|
||||
after_build:
|
||||
# Upload builds. Note that ci.go makes this a no-op PR builds.
|
||||
- go run build/ci.go archive -arch %GETH_ARCH% -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
- go run build/ci.go nsis -arch %GETH_ARCH% -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
|
||||
test_script:
|
||||
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short
|
||||
|
|
@ -32,7 +32,7 @@ var (
|
|||
testServer2 = testServer("testServer2")
|
||||
|
||||
testBlock1 = types.NewBeaconBlock(&deneb.BeaconBlock{
|
||||
Slot: 127,
|
||||
Slot: 123,
|
||||
Body: deneb.BeaconBlockBody{
|
||||
ExecutionPayload: deneb.ExecutionPayload{
|
||||
BlockNumber: 456,
|
||||
|
|
@ -41,7 +41,7 @@ var (
|
|||
},
|
||||
})
|
||||
testBlock2 = types.NewBeaconBlock(&deneb.BeaconBlock{
|
||||
Slot: 128,
|
||||
Slot: 124,
|
||||
Body: deneb.BeaconBlockBody{
|
||||
ExecutionPayload: deneb.ExecutionPayload{
|
||||
BlockNumber: 457,
|
||||
|
|
@ -49,14 +49,6 @@ var (
|
|||
},
|
||||
},
|
||||
})
|
||||
testFinal1 = types.NewExecutionHeader(&deneb.ExecutionPayloadHeader{
|
||||
BlockNumber: 395,
|
||||
BlockHash: zrntcommon.Hash32(common.HexToHash("abbe7625624bf8ddd84723709e2758956289465dd23475f02387e0854942666")),
|
||||
})
|
||||
testFinal2 = types.NewExecutionHeader(&deneb.ExecutionPayloadHeader{
|
||||
BlockNumber: 420,
|
||||
BlockHash: zrntcommon.Hash32(common.HexToHash("9182a6ef8723654de174283750932ccc092378549836bf4873657eeec474598")),
|
||||
})
|
||||
)
|
||||
|
||||
type testServer string
|
||||
|
|
@ -74,10 +66,9 @@ func TestBlockSync(t *testing.T) {
|
|||
ts.AddServer(testServer1, 1)
|
||||
ts.AddServer(testServer2, 1)
|
||||
|
||||
expHeadEvent := func(expHead *types.BeaconBlock, expFinal *types.ExecutionHeader) {
|
||||
expHeadBlock := func(expHead *types.BeaconBlock) {
|
||||
t.Helper()
|
||||
var expNumber, headNumber uint64
|
||||
var expFinalHash, finalHash common.Hash
|
||||
if expHead != nil {
|
||||
p, err := expHead.ExecutionPayload()
|
||||
if err != nil {
|
||||
|
|
@ -85,26 +76,19 @@ func TestBlockSync(t *testing.T) {
|
|||
}
|
||||
expNumber = p.NumberU64()
|
||||
}
|
||||
if expFinal != nil {
|
||||
expFinalHash = expFinal.BlockHash()
|
||||
}
|
||||
select {
|
||||
case event := <-headCh:
|
||||
headNumber = event.Block.NumberU64()
|
||||
finalHash = event.Finalized
|
||||
default:
|
||||
}
|
||||
if headNumber != expNumber {
|
||||
t.Errorf("Wrong head block, expected block number %d, got %d)", expNumber, headNumber)
|
||||
}
|
||||
if finalHash != expFinalHash {
|
||||
t.Errorf("Wrong finalized block, expected block hash %064x, got %064x)", expFinalHash[:], finalHash[:])
|
||||
}
|
||||
}
|
||||
|
||||
// no block requests expected until head tracker knows about a head
|
||||
ts.Run(1)
|
||||
expHeadEvent(nil, nil)
|
||||
expHeadBlock(nil)
|
||||
|
||||
// set block 1 as prefetch head, announced by server 2
|
||||
head1 := blockHeadInfo(testBlock1)
|
||||
|
|
@ -119,13 +103,12 @@ func TestBlockSync(t *testing.T) {
|
|||
ts.AddAllowance(testServer2, 1)
|
||||
ts.Run(3)
|
||||
// head block still not expected as the fetched block is not the validated head yet
|
||||
expHeadEvent(nil, nil)
|
||||
expHeadBlock(nil)
|
||||
|
||||
// set as validated head, expect no further requests but block 1 set as head block
|
||||
ht.validated.Header = testBlock1.Header()
|
||||
ht.finalized, ht.finalizedPayload = testBlock1.Header(), testFinal1
|
||||
ts.Run(4)
|
||||
expHeadEvent(testBlock1, testFinal1)
|
||||
expHeadBlock(testBlock1)
|
||||
|
||||
// set block 2 as prefetch head, announced by server 1
|
||||
head2 := blockHeadInfo(testBlock2)
|
||||
|
|
@ -143,26 +126,17 @@ func TestBlockSync(t *testing.T) {
|
|||
// expect req2 retry to server 2
|
||||
ts.Run(7, testServer2, sync.ReqBeaconBlock(head2.BlockRoot))
|
||||
// now head block should be unavailable again
|
||||
expHeadEvent(nil, nil)
|
||||
expHeadBlock(nil)
|
||||
|
||||
// valid response, now head block should be block 2 immediately as it is already validated
|
||||
// but head event is still not expected because an epoch boundary was crossed and the
|
||||
// expected finality update has not arrived yet
|
||||
ts.RequestEvent(request.EvResponse, ts.Request(7, 1), testBlock2)
|
||||
ts.Run(8)
|
||||
expHeadEvent(nil, nil)
|
||||
|
||||
// expected finality update arrived, now a head event is expected
|
||||
ht.finalized, ht.finalizedPayload = testBlock2.Header(), testFinal2
|
||||
ts.Run(9)
|
||||
expHeadEvent(testBlock2, testFinal2)
|
||||
expHeadBlock(testBlock2)
|
||||
}
|
||||
|
||||
type testHeadTracker struct {
|
||||
prefetch types.HeadInfo
|
||||
validated types.SignedHeader
|
||||
finalized types.Header
|
||||
finalizedPayload *types.ExecutionHeader
|
||||
prefetch types.HeadInfo
|
||||
validated types.SignedHeader
|
||||
}
|
||||
|
||||
func (h *testHeadTracker) PrefetchHead() types.HeadInfo {
|
||||
|
|
@ -177,14 +151,13 @@ func (h *testHeadTracker) ValidatedOptimistic() (types.OptimisticUpdate, bool) {
|
|||
}, h.validated.Header != (types.Header{})
|
||||
}
|
||||
|
||||
// TODO add test case for finality
|
||||
func (h *testHeadTracker) ValidatedFinality() (types.FinalityUpdate, bool) {
|
||||
if h.validated.Header == (types.Header{}) || h.finalizedPayload == nil {
|
||||
return types.FinalityUpdate{}, false
|
||||
}
|
||||
finalized := types.NewExecutionHeader(new(deneb.ExecutionPayloadHeader))
|
||||
return types.FinalityUpdate{
|
||||
Attested: types.HeaderWithExecProof{Header: h.finalized},
|
||||
Finalized: types.HeaderWithExecProof{Header: h.finalized, PayloadHeader: h.finalizedPayload},
|
||||
Attested: types.HeaderWithExecProof{Header: h.validated.Header},
|
||||
Finalized: types.HeaderWithExecProof{PayloadHeader: finalized},
|
||||
Signature: h.validated.Signature,
|
||||
SignatureSlot: h.validated.SignatureSlot,
|
||||
}, true
|
||||
}, h.validated.Header != (types.Header{})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/beacon/params"
|
||||
"github.com/ethereum/go-ethereum/beacon/types"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
ctypes "github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
|
|
@ -87,10 +86,6 @@ func (ec *engineClient) updateLoop(headCh <-chan types.ChainHeadEvent) {
|
|||
if status, err := ec.callForkchoiceUpdated(forkName, event); err == nil {
|
||||
log.Info("Successful ForkchoiceUpdated", "head", event.Block.Hash(), "status", status)
|
||||
} else {
|
||||
if err.Error() == "beacon syncer reorging" {
|
||||
log.Debug("Failed ForkchoiceUpdated", "head", event.Block.Hash(), "error", err)
|
||||
continue // ignore beacon syncer reorging errors, this error can occur if the blsync is skipping a block
|
||||
}
|
||||
log.Error("Failed ForkchoiceUpdated", "head", event.Block.Hash(), "error", err)
|
||||
}
|
||||
}
|
||||
|
|
@ -105,24 +100,20 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
|
|||
params = []any{execData}
|
||||
)
|
||||
switch fork {
|
||||
case "altair", "bellatrix":
|
||||
method = "engine_newPayloadV1"
|
||||
case "capella":
|
||||
method = "engine_newPayloadV2"
|
||||
case "electra":
|
||||
method = "engine_newPayloadV4"
|
||||
parentBeaconRoot := event.BeaconHead.ParentRoot
|
||||
blobHashes := collectBlobHashes(event.Block)
|
||||
params = append(params, blobHashes, parentBeaconRoot, event.ExecRequests)
|
||||
case "deneb":
|
||||
method = "engine_newPayloadV3"
|
||||
parentBeaconRoot := event.BeaconHead.ParentRoot
|
||||
blobHashes := collectBlobHashes(event.Block)
|
||||
params = append(params, blobHashes, parentBeaconRoot)
|
||||
default: // electra, fulu and above
|
||||
method = "engine_newPayloadV4"
|
||||
parentBeaconRoot := event.BeaconHead.ParentRoot
|
||||
blobHashes := collectBlobHashes(event.Block)
|
||||
hexRequests := make([]hexutil.Bytes, len(event.ExecRequests))
|
||||
for i := range event.ExecRequests {
|
||||
hexRequests[i] = hexutil.Bytes(event.ExecRequests[i])
|
||||
}
|
||||
params = append(params, blobHashes, parentBeaconRoot, hexRequests)
|
||||
case "capella":
|
||||
method = "engine_newPayloadV2"
|
||||
default:
|
||||
method = "engine_newPayloadV1"
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
||||
|
|
@ -149,12 +140,12 @@ func (ec *engineClient) callForkchoiceUpdated(fork string, event types.ChainHead
|
|||
|
||||
var method string
|
||||
switch fork {
|
||||
case "altair", "bellatrix":
|
||||
method = "engine_forkchoiceUpdatedV1"
|
||||
case "deneb", "electra":
|
||||
method = "engine_forkchoiceUpdatedV3"
|
||||
case "capella":
|
||||
method = "engine_forkchoiceUpdatedV2"
|
||||
default: // deneb, electra, fulu and above
|
||||
method = "engine_forkchoiceUpdatedV3"
|
||||
default:
|
||||
method = "engine_forkchoiceUpdatedV1"
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
// Copyright 2026 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 engine
|
||||
|
||||
import (
|
||||
"github.com/fjl/jsonw"
|
||||
)
|
||||
|
||||
// MarshalJSON implements json.Marshaler.
|
||||
func (list BlobAndProofListV1) MarshalJSON() ([]byte, error) {
|
||||
if list == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
var b jsonw.Buffer
|
||||
b.Array(func() {
|
||||
for _, item := range list {
|
||||
marshalBlobAndProofV1(&b, item)
|
||||
}
|
||||
})
|
||||
return b.Output(), nil
|
||||
}
|
||||
|
||||
func marshalBlobAndProofV1(b *jsonw.Buffer, item *BlobAndProofV1) {
|
||||
if item == nil {
|
||||
b.Null()
|
||||
} else {
|
||||
b.Object(func() {
|
||||
b.Key("blob")
|
||||
b.HexBytes(item.Blob)
|
||||
b.Key("proof")
|
||||
b.HexBytes(item.Proof)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalJSON implements json.Marshaler.
|
||||
func (list BlobAndProofListV2) MarshalJSON() ([]byte, error) {
|
||||
if list == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
var b jsonw.Buffer
|
||||
b.Array(func() {
|
||||
for _, item := range list {
|
||||
marshalBlobAndProofV2(&b, item)
|
||||
}
|
||||
})
|
||||
return b.Output(), nil
|
||||
}
|
||||
|
||||
func marshalBlobAndProofV2(b *jsonw.Buffer, item *BlobAndProofV2) {
|
||||
if item == nil {
|
||||
b.Null()
|
||||
} else {
|
||||
b.Object(func() {
|
||||
b.Key("blob")
|
||||
b.HexBytes(item.Blob)
|
||||
b.Key("proofs")
|
||||
appendHexBytesArray(b, item.CellProofs)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
// Copyright 2026 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 engine
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/fjl/jsonw"
|
||||
)
|
||||
|
||||
// marshalBlobsBundle writes BlobsBundle as JSON and appends it to buf.
|
||||
func marshalBlobsBundle(b *jsonw.Buffer, bundle *BlobsBundle) {
|
||||
if bundle == nil {
|
||||
b.Null()
|
||||
return
|
||||
}
|
||||
b.Object(func() {
|
||||
b.Key("commitments")
|
||||
appendHexBytesArray(b, bundle.Commitments)
|
||||
b.Key("proofs")
|
||||
appendHexBytesArray(b, bundle.Proofs)
|
||||
b.Key("blobs")
|
||||
appendHexBytesArray(b, bundle.Blobs)
|
||||
})
|
||||
}
|
||||
|
||||
// MarshalJSON implements json.Marshaler.
|
||||
func (e ExecutionPayloadEnvelope) MarshalJSON() ([]byte, error) {
|
||||
if e.ExecutionPayload == nil {
|
||||
return nil, errors.New("missing required field 'executionPayload' for ExecutionPayloadEnvelope")
|
||||
}
|
||||
|
||||
// Pre-marshal the execution payload using its gencodec MarshalJSON.
|
||||
payload, err := e.ExecutionPayload.MarshalJSON()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Pre-marshal the witness.
|
||||
var witness []byte
|
||||
if e.Witness != nil {
|
||||
witness, err = json.Marshal(e.Witness)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Write the execution payload to the buffer
|
||||
var b jsonw.Buffer
|
||||
b.Object(func() {
|
||||
b.Key("executionPayload")
|
||||
b.RawValue(payload)
|
||||
|
||||
b.Key("blockValue")
|
||||
if e.BlockValue != nil {
|
||||
b.HexBigInt(e.BlockValue)
|
||||
} else {
|
||||
b.Null()
|
||||
}
|
||||
|
||||
b.Key("blobsBundle")
|
||||
marshalBlobsBundle(&b, e.BlobsBundle)
|
||||
|
||||
b.Key("executionRequests")
|
||||
if e.Requests == nil {
|
||||
b.Null()
|
||||
} else {
|
||||
appendHexBytesArray(&b, e.Requests)
|
||||
}
|
||||
|
||||
b.Key("shouldOverrideBuilder")
|
||||
b.Bool(e.Override)
|
||||
|
||||
if e.Witness != nil {
|
||||
b.Key("witness")
|
||||
b.RawValue(witness)
|
||||
}
|
||||
})
|
||||
return b.Output(), nil
|
||||
}
|
||||
|
||||
func appendHexBytesArray[T ~[]byte](b *jsonw.Buffer, slice []T) {
|
||||
b.Array(func() {
|
||||
for _, elem := range slice {
|
||||
b.HexBytes(elem)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
// Copyright 2026 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 engine
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
func makeTestPayload() *ExecutableData {
|
||||
return &ExecutableData{
|
||||
ParentHash: common.HexToHash("0x01"),
|
||||
FeeRecipient: common.HexToAddress("0x02"),
|
||||
StateRoot: common.HexToHash("0x03"),
|
||||
ReceiptsRoot: common.HexToHash("0x04"),
|
||||
LogsBloom: make([]byte, 256),
|
||||
Random: common.HexToHash("0x05"),
|
||||
Number: 100,
|
||||
GasLimit: 1000000,
|
||||
GasUsed: 500000,
|
||||
Timestamp: 1234567890,
|
||||
ExtraData: []byte("extra"),
|
||||
BaseFeePerGas: big.NewInt(7),
|
||||
BlockHash: common.HexToHash("0x08"),
|
||||
Transactions: [][]byte{{0xaa, 0xbb}},
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalJSONRoundtrip(t *testing.T) {
|
||||
witness := hexutil.Bytes{0xde, 0xad}
|
||||
original := ExecutionPayloadEnvelope{
|
||||
ExecutionPayload: makeTestPayload(),
|
||||
BlockValue: big.NewInt(12345),
|
||||
BlobsBundle: &BlobsBundle{
|
||||
Commitments: []hexutil.Bytes{{0x01, 0x02}},
|
||||
Proofs: []hexutil.Bytes{{0x03, 0x04}},
|
||||
Blobs: []hexutil.Bytes{{0x05, 0x06}},
|
||||
},
|
||||
Requests: [][]byte{{0xaa}, {0xbb, 0xcc}},
|
||||
Override: true,
|
||||
Witness: &witness,
|
||||
}
|
||||
|
||||
data, err := original.MarshalJSON()
|
||||
if err != nil {
|
||||
t.Fatalf("MarshalJSON error: %v", err)
|
||||
}
|
||||
|
||||
var decoded ExecutionPayloadEnvelope
|
||||
if err := json.Unmarshal(data, &decoded); err != nil {
|
||||
t.Fatalf("UnmarshalJSON error: %v", err)
|
||||
}
|
||||
|
||||
if decoded.ExecutionPayload.Number != original.ExecutionPayload.Number {
|
||||
t.Error("ExecutionPayload.Number mismatch")
|
||||
}
|
||||
if decoded.BlockValue.Cmp(original.BlockValue) != 0 {
|
||||
t.Errorf("BlockValue mismatch: got %v, want %v", decoded.BlockValue, original.BlockValue)
|
||||
}
|
||||
if len(decoded.BlobsBundle.Blobs) != len(original.BlobsBundle.Blobs) {
|
||||
t.Error("BlobsBundle.Blobs length mismatch")
|
||||
}
|
||||
if len(decoded.Requests) != len(original.Requests) {
|
||||
t.Error("Requests length mismatch")
|
||||
}
|
||||
if decoded.Override != original.Override {
|
||||
t.Error("Override mismatch")
|
||||
}
|
||||
if !bytes.Equal(*decoded.Witness, *original.Witness) {
|
||||
t.Error("Witness mismatch")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalJSONNilPayload(t *testing.T) {
|
||||
env := ExecutionPayloadEnvelope{
|
||||
ExecutionPayload: nil,
|
||||
BlockValue: big.NewInt(1),
|
||||
}
|
||||
_, err := env.MarshalJSON()
|
||||
if err == nil {
|
||||
t.Fatal("expected error for nil ExecutionPayload")
|
||||
}
|
||||
}
|
||||
|
||||
// TestExecutionPayloadEnvelopeFieldCoverage guards against structural drift.
|
||||
// If a field is added to or removed from ExecutionPayloadEnvelope, this test
|
||||
// fails, reminding the developer to update MarshalJSON in marshal_epe.go.
|
||||
func TestExecutionPayloadEnvelopeFieldCoverage(t *testing.T) {
|
||||
expected := []string{
|
||||
"ExecutionPayload",
|
||||
"BlockValue",
|
||||
"BlobsBundle",
|
||||
"Requests",
|
||||
"Override",
|
||||
"Witness",
|
||||
}
|
||||
typ := reflect.TypeOf(ExecutionPayloadEnvelope{})
|
||||
if typ.NumField() != len(expected) {
|
||||
t.Fatalf("ExecutionPayloadEnvelope has %d fields, expected %d — update MarshalJSON in marshal_epe.go",
|
||||
typ.NumField(), len(expected))
|
||||
}
|
||||
for i, name := range expected {
|
||||
if typ.Field(i).Name != name {
|
||||
t.Errorf("field %d: got %q, want %q — update MarshalJSON in marshal_epe.go",
|
||||
i, typ.Field(i).Name, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,6 @@ var (
|
|||
TooLargeRequest = &EngineAPIError{code: -38004, msg: "Too large request"}
|
||||
InvalidParams = &EngineAPIError{code: -32602, msg: "Invalid parameters"}
|
||||
UnsupportedFork = &EngineAPIError{code: -38005, msg: "Unsupported fork"}
|
||||
TooDeepReorg = &EngineAPIError{code: -38006, msg: "Too deep reorg"}
|
||||
|
||||
STATUS_INVALID = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
|
||||
STATUS_SYNCING = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ func (p PayloadAttributes) MarshalJSON() ([]byte, error) {
|
|||
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
|
||||
SlotNumber *hexutil.Uint64 `json:"slotNumber"`
|
||||
TargetGasLimit *hexutil.Uint64 `json:"targetGasLimit"`
|
||||
}
|
||||
var enc PayloadAttributes
|
||||
enc.Timestamp = hexutil.Uint64(p.Timestamp)
|
||||
|
|
@ -30,8 +28,6 @@ func (p PayloadAttributes) MarshalJSON() ([]byte, error) {
|
|||
enc.SuggestedFeeRecipient = p.SuggestedFeeRecipient
|
||||
enc.Withdrawals = p.Withdrawals
|
||||
enc.BeaconRoot = p.BeaconRoot
|
||||
enc.SlotNumber = (*hexutil.Uint64)(p.SlotNumber)
|
||||
enc.TargetGasLimit = (*hexutil.Uint64)(p.TargetGasLimit)
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
|
|
@ -43,8 +39,6 @@ func (p *PayloadAttributes) UnmarshalJSON(input []byte) error {
|
|||
SuggestedFeeRecipient *common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
|
||||
SlotNumber *hexutil.Uint64 `json:"slotNumber"`
|
||||
TargetGasLimit *hexutil.Uint64 `json:"targetGasLimit"`
|
||||
}
|
||||
var dec PayloadAttributes
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
|
@ -68,11 +62,5 @@ func (p *PayloadAttributes) UnmarshalJSON(input []byte) error {
|
|||
if dec.BeaconRoot != nil {
|
||||
p.BeaconRoot = dec.BeaconRoot
|
||||
}
|
||||
if dec.SlotNumber != nil {
|
||||
p.SlotNumber = (*uint64)(dec.SlotNumber)
|
||||
}
|
||||
if dec.TargetGasLimit != nil {
|
||||
p.TargetGasLimit = (*uint64)(dec.TargetGasLimit)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -17,25 +17,24 @@ var _ = (*executableDataMarshaling)(nil)
|
|||
// MarshalJSON marshals as JSON.
|
||||
func (e ExecutableData) MarshalJSON() ([]byte, error) {
|
||||
type ExecutableData struct {
|
||||
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom hexutil.Bytes `json:"logsBloom" gencodec:"required"`
|
||||
Random common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
|
||||
BlockAccessList hexutil.Bytes `json:"blockAccessList,omitempty"`
|
||||
SlotNumber *hexutil.Uint64 `json:"slotNumber,omitempty"`
|
||||
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom hexutil.Bytes `json:"logsBloom" gencodec:"required"`
|
||||
Random common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
|
||||
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"`
|
||||
}
|
||||
var enc ExecutableData
|
||||
enc.ParentHash = e.ParentHash
|
||||
|
|
@ -60,33 +59,31 @@ func (e ExecutableData) MarshalJSON() ([]byte, error) {
|
|||
enc.Withdrawals = e.Withdrawals
|
||||
enc.BlobGasUsed = (*hexutil.Uint64)(e.BlobGasUsed)
|
||||
enc.ExcessBlobGas = (*hexutil.Uint64)(e.ExcessBlobGas)
|
||||
enc.BlockAccessList = e.BlockAccessList
|
||||
enc.SlotNumber = (*hexutil.Uint64)(e.SlotNumber)
|
||||
enc.ExecutionWitness = e.ExecutionWitness
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (e *ExecutableData) UnmarshalJSON(input []byte) error {
|
||||
type ExecutableData struct {
|
||||
ParentHash *common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient *common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot *common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot *common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom *hexutil.Bytes `json:"logsBloom" gencodec:"required"`
|
||||
Random *common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number *hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit *hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData *hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash *common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
|
||||
BlockAccessList *hexutil.Bytes `json:"blockAccessList,omitempty"`
|
||||
SlotNumber *hexutil.Uint64 `json:"slotNumber,omitempty"`
|
||||
ParentHash *common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient *common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot *common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot *common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom *hexutil.Bytes `json:"logsBloom" gencodec:"required"`
|
||||
Random *common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number *hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit *hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData *hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash *common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
|
||||
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"`
|
||||
}
|
||||
var dec ExecutableData
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
|
@ -160,11 +157,8 @@ func (e *ExecutableData) UnmarshalJSON(input []byte) error {
|
|||
if dec.ExcessBlobGas != nil {
|
||||
e.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas)
|
||||
}
|
||||
if dec.BlockAccessList != nil {
|
||||
e.BlockAccessList = *dec.BlockAccessList
|
||||
}
|
||||
if dec.SlotNumber != nil {
|
||||
e.SlotNumber = (*uint64)(dec.SlotNumber)
|
||||
if dec.ExecutionWitness != nil {
|
||||
e.ExecutionWitness = dec.ExecutionWitness
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -12,12 +12,37 @@ import (
|
|||
|
||||
var _ = (*executionPayloadEnvelopeMarshaling)(nil)
|
||||
|
||||
// MarshalJSON marshals as JSON.
|
||||
func (e ExecutionPayloadEnvelope) MarshalJSON() ([]byte, error) {
|
||||
type ExecutionPayloadEnvelope struct {
|
||||
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
|
||||
BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"`
|
||||
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"`
|
||||
Requests []hexutil.Bytes `json:"executionRequests"`
|
||||
Override bool `json:"shouldOverrideBuilder"`
|
||||
Witness *hexutil.Bytes `json:"witness,omitempty"`
|
||||
}
|
||||
var enc ExecutionPayloadEnvelope
|
||||
enc.ExecutionPayload = e.ExecutionPayload
|
||||
enc.BlockValue = (*hexutil.Big)(e.BlockValue)
|
||||
enc.BlobsBundle = e.BlobsBundle
|
||||
if e.Requests != nil {
|
||||
enc.Requests = make([]hexutil.Bytes, len(e.Requests))
|
||||
for k, v := range e.Requests {
|
||||
enc.Requests[k] = v
|
||||
}
|
||||
}
|
||||
enc.Override = e.Override
|
||||
enc.Witness = e.Witness
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error {
|
||||
type ExecutionPayloadEnvelope struct {
|
||||
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
|
||||
BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"`
|
||||
BlobsBundle *BlobsBundle `json:"blobsBundle"`
|
||||
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"`
|
||||
Requests []hexutil.Bytes `json:"executionRequests"`
|
||||
Override *bool `json:"shouldOverrideBuilder"`
|
||||
Witness *hexutil.Bytes `json:"witness,omitempty"`
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"slices"
|
||||
|
|
@ -25,10 +24,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/types/bal"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
)
|
||||
|
||||
|
|
@ -37,33 +33,12 @@ import (
|
|||
type PayloadVersion byte
|
||||
|
||||
var (
|
||||
// PayloadV1 is the identifier of ExecutionPayloadV1 introduced in paris fork.
|
||||
// https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#executionpayloadv1
|
||||
PayloadV1 PayloadVersion = 0x1
|
||||
|
||||
// PayloadV2 is the identifier of ExecutionPayloadV2 introduced in shanghai fork.
|
||||
//
|
||||
// https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#executionpayloadv2
|
||||
// ExecutionPayloadV2 has the syntax of ExecutionPayloadV1 and appends a
|
||||
// single field: withdrawals.
|
||||
PayloadV2 PayloadVersion = 0x2
|
||||
|
||||
// PayloadV3 is the identifier of ExecutionPayloadV3 introduced in cancun fork.
|
||||
//
|
||||
// https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#executionpayloadv3
|
||||
// ExecutionPayloadV3 has the syntax of ExecutionPayloadV2 and appends the new
|
||||
// fields: blobGasUsed and excessBlobGas.
|
||||
PayloadV3 PayloadVersion = 0x3
|
||||
|
||||
// PayloadV4 is the identifier of ExecutionPayloadV4 introduced in amsterdam fork.
|
||||
//
|
||||
// https://github.com/ethereum/execution-apis/blob/main/src/engine/amsterdam.md#executionpayloadv4
|
||||
// ExecutionPayloadV4 has the syntax of ExecutionPayloadV3 and appends the new
|
||||
// fields slotNumber and blockAccessList.
|
||||
PayloadV4 PayloadVersion = 0x4
|
||||
)
|
||||
|
||||
//go:generate go run github.com/fjl/gencodec -type PayloadAttributes -field-override payloadAttributesMarshaling -out pa_codec.go
|
||||
//go:generate go run github.com/fjl/gencodec -type PayloadAttributes -field-override payloadAttributesMarshaling -out gen_blockparams.go
|
||||
|
||||
// PayloadAttributes describes the environment context in which a block should
|
||||
// be built.
|
||||
|
|
@ -73,56 +48,49 @@ type PayloadAttributes struct {
|
|||
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
|
||||
SlotNumber *uint64 `json:"slotNumber"`
|
||||
TargetGasLimit *uint64 `json:"targetGasLimit"`
|
||||
}
|
||||
|
||||
// JSON type overrides for PayloadAttributes.
|
||||
type payloadAttributesMarshaling struct {
|
||||
Timestamp hexutil.Uint64
|
||||
SlotNumber *hexutil.Uint64
|
||||
TargetGasLimit *hexutil.Uint64
|
||||
Timestamp hexutil.Uint64
|
||||
}
|
||||
|
||||
//go:generate go run github.com/fjl/gencodec -type ExecutableData -field-override executableDataMarshaling -out ed_codec.go
|
||||
//go:generate go run github.com/fjl/gencodec -type ExecutableData -field-override executableDataMarshaling -out gen_ed.go
|
||||
|
||||
// ExecutableData is the data necessary to execute an EL payload.
|
||||
type ExecutableData struct {
|
||||
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom []byte `json:"logsBloom" gencodec:"required"`
|
||||
Random common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData []byte `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *big.Int `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions [][]byte `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *uint64 `json:"excessBlobGas"`
|
||||
BlockAccessList []byte `json:"blockAccessList,omitempty"`
|
||||
SlotNumber *uint64 `json:"slotNumber,omitempty"`
|
||||
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
|
||||
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
|
||||
StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
|
||||
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
|
||||
LogsBloom []byte `json:"logsBloom" gencodec:"required"`
|
||||
Random common.Hash `json:"prevRandao" gencodec:"required"`
|
||||
Number uint64 `json:"blockNumber" gencodec:"required"`
|
||||
GasLimit uint64 `json:"gasLimit" gencodec:"required"`
|
||||
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
|
||||
Timestamp uint64 `json:"timestamp" gencodec:"required"`
|
||||
ExtraData []byte `json:"extraData" gencodec:"required"`
|
||||
BaseFeePerGas *big.Int `json:"baseFeePerGas" gencodec:"required"`
|
||||
BlockHash common.Hash `json:"blockHash" gencodec:"required"`
|
||||
Transactions [][]byte `json:"transactions" gencodec:"required"`
|
||||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
BlobGasUsed *uint64 `json:"blobGasUsed"`
|
||||
ExcessBlobGas *uint64 `json:"excessBlobGas"`
|
||||
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"`
|
||||
}
|
||||
|
||||
// JSON type overrides for executableData.
|
||||
type executableDataMarshaling struct {
|
||||
Number hexutil.Uint64
|
||||
GasLimit hexutil.Uint64
|
||||
GasUsed hexutil.Uint64
|
||||
Timestamp hexutil.Uint64
|
||||
BaseFeePerGas *hexutil.Big
|
||||
ExtraData hexutil.Bytes
|
||||
LogsBloom hexutil.Bytes
|
||||
Transactions []hexutil.Bytes
|
||||
BlobGasUsed *hexutil.Uint64
|
||||
ExcessBlobGas *hexutil.Uint64
|
||||
SlotNumber *hexutil.Uint64
|
||||
BlockAccessList hexutil.Bytes
|
||||
Number hexutil.Uint64
|
||||
GasLimit hexutil.Uint64
|
||||
GasUsed hexutil.Uint64
|
||||
Timestamp hexutil.Uint64
|
||||
BaseFeePerGas *hexutil.Big
|
||||
ExtraData hexutil.Bytes
|
||||
LogsBloom hexutil.Bytes
|
||||
Transactions []hexutil.Bytes
|
||||
BlobGasUsed *hexutil.Uint64
|
||||
ExcessBlobGas *hexutil.Uint64
|
||||
}
|
||||
|
||||
// StatelessPayloadStatusV1 is the result of a stateless payload execution.
|
||||
|
|
@ -133,29 +101,18 @@ type StatelessPayloadStatusV1 struct {
|
|||
ValidationError *string `json:"validationError"`
|
||||
}
|
||||
|
||||
//go:generate go run github.com/fjl/gencodec -enc=false -type ExecutionPayloadEnvelope -field-override executionPayloadEnvelopeMarshaling -out epe_decode.go
|
||||
//go:generate go run github.com/fjl/gencodec -type ExecutionPayloadEnvelope -field-override executionPayloadEnvelopeMarshaling -out gen_epe.go
|
||||
|
||||
type ExecutionPayloadEnvelope struct {
|
||||
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
|
||||
BlockValue *big.Int `json:"blockValue" gencodec:"required"`
|
||||
BlobsBundle *BlobsBundle `json:"blobsBundle"`
|
||||
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"`
|
||||
Requests [][]byte `json:"executionRequests"`
|
||||
Override bool `json:"shouldOverrideBuilder"`
|
||||
Witness *hexutil.Bytes `json:"witness,omitempty"`
|
||||
}
|
||||
|
||||
// JSON type overrides for ExecutionPayloadEnvelope.
|
||||
type executionPayloadEnvelopeMarshaling struct {
|
||||
BlockValue *hexutil.Big
|
||||
Requests []hexutil.Bytes
|
||||
}
|
||||
|
||||
// BlobsBundle includes the marshalled sidecar data. Note this structure is
|
||||
// shared by BlobsBundleV1 and BlobsBundleV2 for the sake of simplicity.
|
||||
//
|
||||
// - BlobsBundleV1: proofs contain exactly len(blobs) kzg proofs.
|
||||
// - BlobsBundleV2: proofs contain exactly CELLS_PER_EXT_BLOB * len(blobs) cell proofs.
|
||||
type BlobsBundle struct {
|
||||
type BlobsBundleV1 struct {
|
||||
Commitments []hexutil.Bytes `json:"commitments"`
|
||||
Proofs []hexutil.Bytes `json:"proofs"`
|
||||
Blobs []hexutil.Bytes `json:"blobs"`
|
||||
|
|
@ -166,27 +123,15 @@ type BlobAndProofV1 struct {
|
|||
Proof hexutil.Bytes `json:"proof"`
|
||||
}
|
||||
|
||||
// BlobAndProofListV1 is a list of BlobAndProofV1 with a hand-rolled JSON marshaler
|
||||
// that avoids the overhead of encoding/json for large blob payloads.
|
||||
type BlobAndProofListV1 []*BlobAndProofV1
|
||||
|
||||
type BlobAndProofV2 struct {
|
||||
Blob hexutil.Bytes `json:"blob"`
|
||||
CellProofs []hexutil.Bytes `json:"proofs"` // proofs MUST contain exactly CELLS_PER_EXT_BLOB cell proofs.
|
||||
// JSON type overrides for ExecutionPayloadEnvelope.
|
||||
type executionPayloadEnvelopeMarshaling struct {
|
||||
BlockValue *hexutil.Big
|
||||
Requests []hexutil.Bytes
|
||||
}
|
||||
|
||||
type BlobCellsAndProofsV1 struct {
|
||||
BlobCells []*hexutil.Bytes `json:"blob_cells"`
|
||||
Proofs []*hexutil.Bytes `json:"proofs"`
|
||||
}
|
||||
|
||||
// BlobAndProofListV2 is a list of BlobAndProofV2 with a hand-rolled JSON marshaler
|
||||
// that avoids the overhead of encoding/json for large blob payloads.
|
||||
type BlobAndProofListV2 []*BlobAndProofV2
|
||||
|
||||
type PayloadStatusV1 struct {
|
||||
Status string `json:"status"`
|
||||
Witness *hexutil.Bytes `json:"witness,omitempty"`
|
||||
Witness *hexutil.Bytes `json:"witness"`
|
||||
LatestValidHash *common.Hash `json:"latestValidHash"`
|
||||
ValidationError *string `json:"validationError"`
|
||||
}
|
||||
|
|
@ -245,7 +190,7 @@ func encodeTransactions(txs []*types.Transaction) [][]byte {
|
|||
return enc
|
||||
}
|
||||
|
||||
func DecodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
|
||||
func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
|
||||
var txs = make([]*types.Transaction, len(enc))
|
||||
for i, encTx := range enc {
|
||||
var tx types.Transaction
|
||||
|
|
@ -283,7 +228,7 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
|
|||
// for stateless execution, so it skips checking if the executable data hashes to
|
||||
// the requested hash (stateless has to *compute* the root hash, it's not given).
|
||||
func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, requests [][]byte) (*types.Block, error) {
|
||||
txs, err := DecodeTransactions(data.Transactions)
|
||||
txs, err := decodeTransactions(data.Transactions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -297,7 +242,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
|
|||
if data.BaseFeePerGas != nil && (data.BaseFeePerGas.Sign() == -1 || data.BaseFeePerGas.BitLen() > 256) {
|
||||
return nil, fmt.Errorf("invalid baseFeePerGas: %v", data.BaseFeePerGas)
|
||||
}
|
||||
var blobHashes = make([]common.Hash, 0, len(versionedHashes))
|
||||
var blobHashes = make([]common.Hash, 0, len(txs))
|
||||
for _, tx := range txs {
|
||||
blobHashes = append(blobHashes, tx.BlobHashes()...)
|
||||
}
|
||||
|
|
@ -306,7 +251,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
|
|||
}
|
||||
for i := 0; i < len(blobHashes); i++ {
|
||||
if blobHashes[i] != versionedHashes[i] {
|
||||
return nil, fmt.Errorf("invalid versionedHash at %v: %v blobHash: %v", i, versionedHashes[i], blobHashes[i])
|
||||
return nil, fmt.Errorf("invalid versionedHash at %v: %v blobHashes: %v", i, versionedHashes, blobHashes)
|
||||
}
|
||||
}
|
||||
// Only set withdrawalsRoot if it is non-nil. This allows CLs to use
|
||||
|
|
@ -324,103 +269,69 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
|
|||
requestsHash = &h
|
||||
}
|
||||
|
||||
// If Amsterdam is enabled, data.BlockAccessList is always non-nil,
|
||||
// even for empty blocks with no state transitions.
|
||||
//
|
||||
// If Amsterdam is not enabled yet, blockAccessListHash is expected
|
||||
// to be nil.
|
||||
var blockAccessListHash *common.Hash
|
||||
if data.BlockAccessList != nil {
|
||||
hash := crypto.Keccak256Hash(data.BlockAccessList)
|
||||
blockAccessListHash = &hash
|
||||
}
|
||||
header := &types.Header{
|
||||
ParentHash: data.ParentHash,
|
||||
UncleHash: types.EmptyUncleHash,
|
||||
Coinbase: data.FeeRecipient,
|
||||
Root: data.StateRoot,
|
||||
TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)),
|
||||
ReceiptHash: data.ReceiptsRoot,
|
||||
Bloom: types.BytesToBloom(data.LogsBloom),
|
||||
Difficulty: common.Big0,
|
||||
Number: new(big.Int).SetUint64(data.Number),
|
||||
GasLimit: data.GasLimit,
|
||||
GasUsed: data.GasUsed,
|
||||
Time: data.Timestamp,
|
||||
BaseFee: data.BaseFeePerGas,
|
||||
Extra: data.ExtraData,
|
||||
MixDigest: data.Random,
|
||||
WithdrawalsHash: withdrawalsRoot,
|
||||
ExcessBlobGas: data.ExcessBlobGas,
|
||||
BlobGasUsed: data.BlobGasUsed,
|
||||
ParentBeaconRoot: beaconRoot,
|
||||
RequestsHash: requestsHash,
|
||||
SlotNumber: data.SlotNumber,
|
||||
BlockAccessListHash: blockAccessListHash,
|
||||
ParentHash: data.ParentHash,
|
||||
UncleHash: types.EmptyUncleHash,
|
||||
Coinbase: data.FeeRecipient,
|
||||
Root: data.StateRoot,
|
||||
TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)),
|
||||
ReceiptHash: data.ReceiptsRoot,
|
||||
Bloom: types.BytesToBloom(data.LogsBloom),
|
||||
Difficulty: common.Big0,
|
||||
Number: new(big.Int).SetUint64(data.Number),
|
||||
GasLimit: data.GasLimit,
|
||||
GasUsed: data.GasUsed,
|
||||
Time: data.Timestamp,
|
||||
BaseFee: data.BaseFeePerGas,
|
||||
Extra: data.ExtraData,
|
||||
MixDigest: data.Random,
|
||||
WithdrawalsHash: withdrawalsRoot,
|
||||
ExcessBlobGas: data.ExcessBlobGas,
|
||||
BlobGasUsed: data.BlobGasUsed,
|
||||
ParentBeaconRoot: beaconRoot,
|
||||
RequestsHash: requestsHash,
|
||||
}
|
||||
body := types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}
|
||||
if data.BlockAccessList != nil {
|
||||
var accessList bal.BlockAccessList
|
||||
if err := rlp.DecodeBytes(data.BlockAccessList, &accessList); err != nil {
|
||||
return nil, fmt.Errorf("failed to decode BAL: %w", err)
|
||||
}
|
||||
return types.NewBlockWithHeader(header).WithBody(body).WithAccessListUnsafe(&accessList), nil
|
||||
}
|
||||
return types.NewBlockWithHeader(header).WithBody(body), nil
|
||||
return types.NewBlockWithHeader(header).
|
||||
WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}).
|
||||
WithWitness(data.ExecutionWitness),
|
||||
nil
|
||||
}
|
||||
|
||||
// BlockToExecutableData constructs the ExecutableData structure by filling the
|
||||
// fields from the given block. It assumes the given block is post-merge block.
|
||||
func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.BlobTxSidecar, requests [][]byte) *ExecutionPayloadEnvelope {
|
||||
data := &ExecutableData{
|
||||
BlockHash: block.Hash(),
|
||||
ParentHash: block.ParentHash(),
|
||||
FeeRecipient: block.Coinbase(),
|
||||
StateRoot: block.Root(),
|
||||
Number: block.NumberU64(),
|
||||
GasLimit: block.GasLimit(),
|
||||
GasUsed: block.GasUsed(),
|
||||
BaseFeePerGas: block.BaseFee(),
|
||||
Timestamp: block.Time(),
|
||||
ReceiptsRoot: block.ReceiptHash(),
|
||||
LogsBloom: block.Bloom().Bytes(),
|
||||
Transactions: encodeTransactions(block.Transactions()),
|
||||
Random: block.MixDigest(),
|
||||
ExtraData: block.Extra(),
|
||||
Withdrawals: block.Withdrawals(),
|
||||
BlobGasUsed: block.BlobGasUsed(),
|
||||
ExcessBlobGas: block.ExcessBlobGas(),
|
||||
SlotNumber: block.SlotNumber(),
|
||||
}
|
||||
if al := block.AccessList(); al != nil {
|
||||
var buf bytes.Buffer
|
||||
if err := rlp.Encode(&buf, al); err == nil {
|
||||
data.BlockAccessList = buf.Bytes()
|
||||
}
|
||||
BlockHash: block.Hash(),
|
||||
ParentHash: block.ParentHash(),
|
||||
FeeRecipient: block.Coinbase(),
|
||||
StateRoot: block.Root(),
|
||||
Number: block.NumberU64(),
|
||||
GasLimit: block.GasLimit(),
|
||||
GasUsed: block.GasUsed(),
|
||||
BaseFeePerGas: block.BaseFee(),
|
||||
Timestamp: block.Time(),
|
||||
ReceiptsRoot: block.ReceiptHash(),
|
||||
LogsBloom: block.Bloom().Bytes(),
|
||||
Transactions: encodeTransactions(block.Transactions()),
|
||||
Random: block.MixDigest(),
|
||||
ExtraData: block.Extra(),
|
||||
Withdrawals: block.Withdrawals(),
|
||||
BlobGasUsed: block.BlobGasUsed(),
|
||||
ExcessBlobGas: block.ExcessBlobGas(),
|
||||
ExecutionWitness: block.ExecutionWitness(),
|
||||
}
|
||||
|
||||
// Add blobs.
|
||||
bundle := BlobsBundle{
|
||||
bundle := BlobsBundleV1{
|
||||
Commitments: make([]hexutil.Bytes, 0),
|
||||
Blobs: make([]hexutil.Bytes, 0),
|
||||
Proofs: make([]hexutil.Bytes, 0),
|
||||
}
|
||||
for _, sidecar := range sidecars {
|
||||
for j := range sidecar.Blobs {
|
||||
bundle.Blobs = append(bundle.Blobs, sidecar.Blobs[j][:])
|
||||
bundle.Commitments = append(bundle.Commitments, sidecar.Commitments[j][:])
|
||||
}
|
||||
// - Before the Osaka fork, only version-0 blob transactions should be packed,
|
||||
// with the proof length equal to len(blobs).
|
||||
//
|
||||
// - After the Osaka fork, only version-1 blob transactions should be packed,
|
||||
// with the proof length equal to CELLS_PER_EXT_BLOB * len(blobs).
|
||||
//
|
||||
// Ideally, length validation should be performed based on the bundle version.
|
||||
// In practice, this is unnecessary because blob transaction filtering is
|
||||
// already done during payload construction.
|
||||
for _, proof := range sidecar.Proofs {
|
||||
bundle.Proofs = append(bundle.Proofs, proof[:])
|
||||
bundle.Blobs = append(bundle.Blobs, hexutil.Bytes(sidecar.Blobs[j][:]))
|
||||
bundle.Commitments = append(bundle.Commitments, hexutil.Bytes(sidecar.Commitments[j][:]))
|
||||
bundle.Proofs = append(bundle.Proofs, hexutil.Bytes(sidecar.Proofs[j][:]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -439,12 +350,6 @@ type ExecutionPayloadBody struct {
|
|||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
}
|
||||
|
||||
// ExecutionPayloadBodyV2 extends ExecutionPayloadBody with the block access list.
|
||||
type ExecutionPayloadBodyV2 struct {
|
||||
ExecutionPayloadBody
|
||||
BlockAccessList *hexutil.Bytes `json:"blockAccessList"`
|
||||
}
|
||||
|
||||
// Client identifiers to support ClientVersionV1.
|
||||
const (
|
||||
ClientCode = "GE"
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
// 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 engine
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto/kzg4844"
|
||||
)
|
||||
|
||||
func TestBlobs(t *testing.T) {
|
||||
var (
|
||||
emptyBlob = new(kzg4844.Blob)
|
||||
emptyBlobCommit, _ = kzg4844.BlobToCommitment(emptyBlob)
|
||||
emptyBlobProof, _ = kzg4844.ComputeBlobProof(emptyBlob, emptyBlobCommit)
|
||||
emptyCellProof, _ = kzg4844.ComputeCellProofs(emptyBlob)
|
||||
)
|
||||
header := types.Header{}
|
||||
block := types.NewBlock(&header, &types.Body{}, nil, nil)
|
||||
|
||||
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.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))
|
||||
}
|
||||
}
|
||||
|
|
@ -69,10 +69,7 @@ func newCanonicalStore[T any](db ethdb.Iteratee, keyPrefix []byte) (*canonicalSt
|
|||
|
||||
// databaseKey returns the database key belonging to the given period.
|
||||
func (cs *canonicalStore[T]) databaseKey(period uint64) []byte {
|
||||
key := make([]byte, len(cs.keyPrefix)+8)
|
||||
copy(key, cs.keyPrefix)
|
||||
binary.BigEndian.PutUint64(key[len(cs.keyPrefix):], period)
|
||||
return key
|
||||
return binary.BigEndian.AppendUint64(append([]byte{}, cs.keyPrefix...), period)
|
||||
}
|
||||
|
||||
// add adds the given item to the database. It also ensures that the range remains
|
||||
|
|
|
|||
|
|
@ -182,12 +182,6 @@ func (s *CommitteeChain) Reset() {
|
|||
s.chainmu.Lock()
|
||||
defer s.chainmu.Unlock()
|
||||
|
||||
s.resetLocked()
|
||||
}
|
||||
|
||||
// ResetLocked resets the committee chain without locking. The caller should hold
|
||||
// the chainmu lock.
|
||||
func (s *CommitteeChain) resetLocked() {
|
||||
if err := s.rollback(0); err != nil {
|
||||
log.Error("Error writing batch into chain database", "error", err)
|
||||
}
|
||||
|
|
@ -207,22 +201,22 @@ func (s *CommitteeChain) CheckpointInit(bootstrap types.BootstrapData) error {
|
|||
}
|
||||
period := bootstrap.Header.SyncPeriod()
|
||||
if err := s.deleteFixedCommitteeRootsFrom(period + 2); err != nil {
|
||||
s.resetLocked()
|
||||
s.Reset()
|
||||
return err
|
||||
}
|
||||
if s.addFixedCommitteeRoot(period, bootstrap.CommitteeRoot) != nil {
|
||||
s.resetLocked()
|
||||
s.Reset()
|
||||
if err := s.addFixedCommitteeRoot(period, bootstrap.CommitteeRoot); err != nil {
|
||||
s.resetLocked()
|
||||
s.Reset()
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := s.addFixedCommitteeRoot(period+1, common.Hash(bootstrap.CommitteeBranch[0])); err != nil {
|
||||
s.resetLocked()
|
||||
s.Reset()
|
||||
return err
|
||||
}
|
||||
if err := s.addCommittee(period, bootstrap.Committee); err != nil {
|
||||
s.resetLocked()
|
||||
s.Reset()
|
||||
return err
|
||||
}
|
||||
s.changeCounter++
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ func (s *Scheduler) addEvent(event Event) {
|
|||
s.Trigger()
|
||||
}
|
||||
|
||||
// filterEvents sorts each Event either as a request event or a server event,
|
||||
// filterEvent sorts each Event either as a request event or a server event,
|
||||
// depending on its type. Request events are also sorted in a map based on the
|
||||
// module that originally initiated the request. It also ensures that no events
|
||||
// related to a server are returned before EvRegistered or after EvUnregistered.
|
||||
|
|
|
|||
|
|
@ -438,11 +438,14 @@ func (s *serverWithLimits) fail(desc string) {
|
|||
// failLocked calculates the dynamic failure delay and applies it.
|
||||
func (s *serverWithLimits) failLocked(desc string) {
|
||||
log.Debug("Server error", "description", desc)
|
||||
s.failureDelay *= 2
|
||||
now := s.clock.Now()
|
||||
if now > s.failureDelayEnd {
|
||||
s.failureDelay *= math.Pow(2, -float64(now-s.failureDelayEnd)/float64(maxFailureDelay))
|
||||
}
|
||||
s.failureDelay = max(min(s.failureDelay*2, float64(maxFailureDelay)), float64(minFailureDelay))
|
||||
if s.failureDelay < float64(minFailureDelay) {
|
||||
s.failureDelay = float64(minFailureDelay)
|
||||
}
|
||||
s.failureDelayEnd = now + mclock.AbsTime(s.failureDelay)
|
||||
s.delay(time.Duration(s.failureDelay))
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue