Fix rlp package

This commit is contained in:
Roy Crihfield 2024-03-28 17:42:18 +08:00
parent 2bd23e1f3c
commit b748b08558
9 changed files with 39 additions and 8 deletions

View File

@ -0,0 +1,31 @@
// Copyright 2014 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 rlp
import (
"encoding/hex"
"fmt"
"strings"
)
func unhex(str string) []byte {
b, err := hex.DecodeString(strings.ReplaceAll(str, " ", ""))
if err != nil {
panic(fmt.Sprintf("invalid hex string: %q", str))
}
return b
}

View File

@ -27,7 +27,7 @@ import (
"golang.org/x/tools/go/packages" "golang.org/x/tools/go/packages"
) )
const pathOfPackageRLP = "github.com/ethereum/go-ethereum/rlp" const pathOfPackageRLP = "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
func main() { func main() {
var ( var (

View File

@ -1,6 +1,6 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {

View File

@ -1,6 +1,6 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {

View File

@ -1,6 +1,6 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {

View File

@ -2,7 +2,7 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
type Test struct { type Test struct {
RawValue rlp.RawValue RawValue rlp.RawValue

View File

@ -1,6 +1,6 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {

View File

@ -1,7 +1,7 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp"
import "github.com/holiman/uint256" import "github.com/holiman/uint256"
import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {

View File

@ -1,6 +1,6 @@
package test package test
import "github.com/ethereum/go-ethereum/rlp" import "github.com/openrelayxyz/plugeth-utils/restricted/rlp"
import "io" import "io"
func (obj *Test) EncodeRLP(_w io.Writer) error { func (obj *Test) EncodeRLP(_w io.Writer) error {