Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge commits under tag of scroll-v3.3.0 from scroll-tech #10

Merged
merged 10 commits into from
May 25, 2023
Merged
24 changes: 23 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,32 @@
...


## 2. Deployment tag versioning
## 2. PR title

Your PR title must follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) (as we are doing squash merge for each PR), so it must start with one of the following [types](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type):

- [ ] build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
- [ ] ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
- [ ] docs: Documentation-only changes
- [ ] feat: A new feature
- [ ] fix: A bug fix
- [ ] perf: A code change that improves performance
- [ ] refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
- [ ] style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- [ ] test: Adding missing tests or correcting existing tests


## 3. Deployment tag versioning

Has the version in `params/version.go` been updated?

- [ ] This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
- [ ] Yes


## 4. Breaking change label

Does this PR have the `breaking-change` label?

- [ ] This PR is not a breaking change
- [ ] Yes
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker
on:
push:
tags:
- scroll-v**
- '*'

jobs:
build-and-push:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/l2geth_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ on:
- develop
- alpha
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
name: CI
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand All @@ -21,6 +27,7 @@ jobs:
run: |
make geth
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand All @@ -34,6 +41,7 @@ jobs:
rm -rf $HOME/.cache/golangci-lint
make lint
goimports-lint:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand All @@ -53,6 +61,7 @@ jobs:
exit 1
fi
test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand Down
17 changes: 14 additions & 3 deletions cmd/abigen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ var (
Name: "alias",
Usage: "Comma separated aliases for function and event renaming, e.g. original1=alias1, original2=alias2",
}
contractFlag = cli.StringFlag{
Name: "contract",
Usage: "Name of the contract to generate the bindings for",
}
)

func init() {
Expand All @@ -117,6 +121,7 @@ func init() {
outFlag,
langFlag,
aliasFlag,
contractFlag,
}
app.Action = utils.MigrateFlags(abigen)
cli.CommandHelpTemplate = flags.OriginCommandHelpTemplate
Expand Down Expand Up @@ -225,6 +230,13 @@ func abigen(c *cli.Context) error {
}
// Gather all non-excluded contract for binding
for name, contract := range contracts {
// The fully qualified name is of the form <solFilePath>:<type>
nameParts := strings.Split(name, ":")
typeName := nameParts[len(nameParts)-1]
// If a contract name is provided then ignore all other contracts
if c.GlobalIsSet(contractFlag.Name) && c.GlobalString(contractFlag.Name) != typeName {
continue
}
if exclude[strings.ToLower(name)] {
continue
}
Expand All @@ -235,11 +247,10 @@ func abigen(c *cli.Context) error {
abis = append(abis, string(abi))
bins = append(bins, contract.Code)
sigs = append(sigs, contract.Hashes)
nameParts := strings.Split(name, ":")
types = append(types, nameParts[len(nameParts)-1])
types = append(types, typeName)

libPattern := crypto.Keccak256Hash([]byte(name)).String()[2:36]
libs[libPattern] = nameParts[len(nameParts)-1]
libs[libPattern] = typeName
}
}
// Extract all aliases from the flags
Expand Down
34 changes: 34 additions & 0 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import (
"golang.org/x/crypto/ripemd160"
)

var (
errPrecompileDisabled = errors.New("sha256, ripemd160, blake2f precompiles temporarily disabled")
)

// PrecompiledContract is the basic interface for native Go contracts. The implementation
// requires a deterministic gas count based on the input size of the Run method of the
// contract.
Expand Down Expand Up @@ -96,11 +100,14 @@ var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
// contracts used in the Archimedes release. Same as Berlin but without sha2, blake2f, ripemd160
var PrecompiledContractsArchimedes = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{1}): &ecrecover{},
common.BytesToAddress([]byte{2}): &sha256hashDisabled{},
common.BytesToAddress([]byte{3}): &ripemd160hashDisabled{},
common.BytesToAddress([]byte{4}): &dataCopy{},
common.BytesToAddress([]byte{5}): &bigModExp{eip2565: true},
common.BytesToAddress([]byte{6}): &bn256AddIstanbul{},
common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{},
common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{},
common.BytesToAddress([]byte{9}): &blake2FDisabled{},
}

// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
Expand Down Expand Up @@ -227,6 +234,15 @@ func (c *sha256hash) Run(input []byte) ([]byte, error) {
return h[:], nil
}

type sha256hashDisabled struct{}

func (c *sha256hashDisabled) RequiredGas(input []byte) uint64 {
return (&sha256hash{}).RequiredGas(input)
}
func (c *sha256hashDisabled) Run(input []byte) ([]byte, error) {
return nil, errPrecompileDisabled
}

// RIPEMD160 implemented as a native contract.
type ripemd160hash struct{}

Expand All @@ -243,6 +259,15 @@ func (c *ripemd160hash) Run(input []byte) ([]byte, error) {
return common.LeftPadBytes(ripemd.Sum(nil), 32), nil
}

type ripemd160hashDisabled struct{}

func (c *ripemd160hashDisabled) RequiredGas(input []byte) uint64 {
return (&ripemd160hash{}).RequiredGas(input)
}
func (c *ripemd160hashDisabled) Run(input []byte) ([]byte, error) {
return nil, errPrecompileDisabled
}

// data copy implemented as a native contract.
type dataCopy struct{}

Expand Down Expand Up @@ -636,6 +661,15 @@ func (c *blake2F) Run(input []byte) ([]byte, error) {
return output, nil
}

type blake2FDisabled struct{}

func (c *blake2FDisabled) RequiredGas(input []byte) uint64 {
return (&blake2F{}).RequiredGas(input)
}
func (c *blake2FDisabled) Run(input []byte) ([]byte, error) {
return nil, errPrecompileDisabled
}

var (
errBLS12381InvalidInputLength = errors.New("invalid input length")
errBLS12381InvalidFieldElementTopBytes = errors.New("invalid field element top bytes")
Expand Down
4 changes: 2 additions & 2 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"golang.org/x/crypto/sha3"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/rollup/rcfg"
)

// Genesis hashes to enforce below configs on.
Expand Down Expand Up @@ -255,7 +256,6 @@ var (
}

// ScrollAlphaChainConfig contains the chain parameters to run a node on the Scroll Alpha test network.
ScrollFeeVaultAddress = common.HexToAddress("0x5300000000000000000000000000000000000005")
ScrollMaxTxPerBlock = 44
ScrollMaxTxPayloadBytesPerBlock = 120 * 1024

Expand Down Expand Up @@ -285,7 +285,7 @@ var (
UseZktrie: true,
MaxTxPerBlock: &ScrollMaxTxPerBlock,
MaxTxPayloadBytesPerBlock: &ScrollMaxTxPayloadBytesPerBlock,
FeeVaultAddress: &ScrollFeeVaultAddress,
FeeVaultAddress: &rcfg.ScrollFeeVaultAddress,
EnableEIP2718: false,
EnableEIP1559: false,
},
Expand Down
7 changes: 4 additions & 3 deletions params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

const (
VersionMajor = 3 // Major version component of the current release
VersionMinor = 2 // Minor version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionMeta = "alpha" // Version metadata to append to the version string
)

Expand All @@ -44,7 +44,8 @@ var VersionWithMeta = func() string {

// ArchiveVersion holds the textual version string used for Geth archives.
// e.g. "1.8.11-dea1ce05" for stable releases, or
// "1.8.13-unstable-21c059b6" for unstable releases
//
// "1.8.13-unstable-21c059b6" for unstable releases
func ArchiveVersion(gitCommit string) string {
vsn := Version
if VersionMeta != "stable" {
Expand Down
5 changes: 5 additions & 0 deletions rollup/rcfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ var (
L2MessageQueueAddress = common.HexToAddress("0x5300000000000000000000000000000000000000")
WithdrawTrieRootSlot = common.BigToHash(big.NewInt(0))

// ScrollFeeVaultAddress is the address of the L2TxFeeVault
// predeploy
// see scroll-tech/scroll/contracts/src/L2/predeploys/L2TxFeeVault.sol
ScrollFeeVaultAddress = common.HexToAddress("0x5300000000000000000000000000000000000005")

// L1GasPriceOracleAddress is the address of the L1GasPriceOracle
// predeploy
// see scroll-tech/scroll/contracts/src/L2/predeploys/L1GasPriceOracle.sol
Expand Down