Skip to content

Commit 4433ebb

Browse files
committed
all: tidy up parallax client; rename eth -> prl ethereum -> parallax, etc
1 parent 10ad5e8 commit 4433ebb

File tree

145 files changed

+1430
-1342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1430
-1342
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ linters:
6363
- path: cmd/utils/flags.go
6464
text: "SA1019: cfg.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
6565
- path: cmd/utils/flags.go
66-
text: "SA1019: ethconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
66+
text: "SA1019: prlconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
6767
- path: internal/build/pgp.go
6868
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
6969
- path: core/vm/contracts.go

accounts/abi/bind/backend.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"errors"
2222
"math/big"
2323

24-
ethereum "github.com/microstack-tech/parallax"
24+
"github.com/microstack-tech/parallax"
2525
"github.com/microstack-tech/parallax/common"
2626
"github.com/microstack-tech/parallax/core/types"
2727
)
@@ -50,7 +50,7 @@ type ContractCaller interface {
5050

5151
// CallContract executes an Parallax contract call with the specified data as the
5252
// input.
53-
CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
53+
CallContract(ctx context.Context, call parallax.CallMsg, blockNumber *big.Int) ([]byte, error)
5454
}
5555

5656
// PendingContractCaller defines methods to perform contract calls on the pending state.
@@ -61,7 +61,7 @@ type PendingContractCaller interface {
6161
PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
6262

6363
// PendingCallContract executes an Parallax contract call against the pending state.
64-
PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error)
64+
PendingCallContract(ctx context.Context, call parallax.CallMsg) ([]byte, error)
6565
}
6666

6767
// ContractTransactor defines the methods needed to allow operating with a contract
@@ -92,7 +92,7 @@ type ContractTransactor interface {
9292
// There is no guarantee that this is the true gas limit requirement as other
9393
// transactions may be added or removed by miners, but it should provide a basis
9494
// for setting a reasonable default.
95-
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
95+
EstimateGas(ctx context.Context, call parallax.CallMsg) (gas uint64, err error)
9696

9797
// SendTransaction injects the transaction into the pending pool for execution.
9898
SendTransaction(ctx context.Context, tx *types.Transaction) error
@@ -105,11 +105,11 @@ type ContractFilterer interface {
105105
// returning all the results in one batch.
106106
//
107107
// TODO(karalabe): Deprecate when the subscription one can return past data too.
108-
FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
108+
FilterLogs(ctx context.Context, query parallax.FilterQuery) ([]types.Log, error)
109109

110110
// SubscribeFilterLogs creates a background log filtering operation, returning
111111
// a subscription immediately, which can be used to stream the found events.
112-
SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
112+
SubscribeFilterLogs(ctx context.Context, query parallax.FilterQuery, ch chan<- types.Log) (parallax.Subscription, error)
113113
}
114114

115115
// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.

accounts/abi/bind/backends/simulated.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"sync"
2525
"time"
2626

27-
ethereum "github.com/microstack-tech/parallax"
27+
"github.com/microstack-tech/parallax"
2828
"github.com/microstack-tech/parallax/accounts/abi"
2929
"github.com/microstack-tech/parallax/accounts/abi/bind"
3030
"github.com/microstack-tech/parallax/common"
@@ -231,7 +231,7 @@ func (b *SimulatedBackend) TransactionReceipt(ctx context.Context, txHash common
231231

232232
receipt, _, _, _ := rawdb.ReadReceipt(b.database, txHash, b.config)
233233
if receipt == nil {
234-
return nil, ethereum.NotFound
234+
return nil, parallax.ErrNotFound
235235
}
236236
return receipt, nil
237237
}
@@ -252,7 +252,7 @@ func (b *SimulatedBackend) TransactionByHash(ctx context.Context, txHash common.
252252
if tx != nil {
253253
return tx, false, nil
254254
}
255-
return nil, false, ethereum.NotFound
255+
return nil, false, parallax.ErrNotFound
256256
}
257257

258258
// BlockByHash retrieves a block based on the block hash.
@@ -414,7 +414,7 @@ func (e *revertError) ErrorData() any {
414414
}
415415

416416
// CallContract executes a contract call.
417-
func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
417+
func (b *SimulatedBackend) CallContract(ctx context.Context, call parallax.CallMsg, blockNumber *big.Int) ([]byte, error) {
418418
b.mu.Lock()
419419
defer b.mu.Unlock()
420420

@@ -437,7 +437,7 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallM
437437
}
438438

439439
// PendingCallContract executes a contract call on the pending state.
440-
func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error) {
440+
func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call parallax.CallMsg) ([]byte, error) {
441441
b.mu.Lock()
442442
defer b.mu.Unlock()
443443
defer b.pendingState.RevertToSnapshot(b.pendingState.Snapshot())
@@ -482,7 +482,7 @@ func (b *SimulatedBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, erro
482482

483483
// EstimateGas executes the requested code against the currently pending block/state and
484484
// returns the used amount of gas.
485-
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) {
485+
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call parallax.CallMsg) (uint64, error) {
486486
b.mu.Lock()
487487
defer b.mu.Unlock()
488488

@@ -585,7 +585,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
585585

586586
// callContract implements common code between normal and pending contract calls.
587587
// state is modified during execution, make sure to copy it if necessary.
588-
func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallMsg, block *types.Block, stateDB *state.StateDB) (*core.ExecutionResult, error) {
588+
func (b *SimulatedBackend) callContract(ctx context.Context, call parallax.CallMsg, block *types.Block, stateDB *state.StateDB) (*core.ExecutionResult, error) {
589589
// Gas prices post 1559 need to be initialized
590590
if call.GasPrice != nil && (call.GasFeeCap != nil || call.GasTipCap != nil) {
591591
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
@@ -678,7 +678,7 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa
678678
// returning all the results in one batch.
679679
//
680680
// TODO(karalabe): Deprecate when the subscription one can return past data too.
681-
func (b *SimulatedBackend) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error) {
681+
func (b *SimulatedBackend) FilterLogs(ctx context.Context, query parallax.FilterQuery) ([]types.Log, error) {
682682
var filter *filters.Filter
683683
if query.BlockHash != nil {
684684
// Block filter requested, construct a single-shot filter
@@ -710,7 +710,7 @@ func (b *SimulatedBackend) FilterLogs(ctx context.Context, query ethereum.Filter
710710

711711
// SubscribeFilterLogs creates a background log filtering operation, returning a
712712
// subscription immediately, which can be used to stream the found events.
713-
func (b *SimulatedBackend) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
713+
func (b *SimulatedBackend) SubscribeFilterLogs(ctx context.Context, query parallax.FilterQuery, ch chan<- types.Log) (parallax.Subscription, error) {
714714
// Subscribe to contract events
715715
sink := make(chan []*types.Log)
716716

@@ -743,7 +743,7 @@ func (b *SimulatedBackend) SubscribeFilterLogs(ctx context.Context, query ethere
743743
}
744744

745745
// SubscribeNewHead returns an event subscription for a new header.
746-
func (b *SimulatedBackend) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
746+
func (b *SimulatedBackend) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (parallax.Subscription, error) {
747747
// subscribe to a new head
748748
sink := make(chan *types.Header)
749749
sub := b.events.SubscribeNewHeads(sink)
@@ -793,7 +793,7 @@ func (b *SimulatedBackend) Blockchain() *core.BlockChain {
793793

794794
// callMsg implements core.Message to allow passing it as a transaction simulator.
795795
type callMsg struct {
796-
ethereum.CallMsg
796+
parallax.CallMsg
797797
}
798798

799799
func (m callMsg) From() common.Address { return m.CallMsg.From }

accounts/abi/bind/backends/simulated_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestSimulatedBackend(t *testing.T) {
5454
if isPending {
5555
t.Fatal("transaction should not be pending")
5656
}
57-
if err != parallax.NotFound {
57+
if err != parallax.ErrNotFound {
5858
t.Fatalf("err should be `ethereum.NotFound` but received %v", err)
5959
}
6060

accounts/abi/bind/base.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525
"sync"
2626

27-
ethereum "github.com/microstack-tech/parallax"
27+
"github.com/microstack-tech/parallax"
2828
"github.com/microstack-tech/parallax/accounts/abi"
2929
"github.com/microstack-tech/parallax/common"
3030
"github.com/microstack-tech/parallax/core/types"
@@ -160,7 +160,7 @@ func (c *BoundContract) Call(opts *CallOpts, results *[]any, method string, para
160160
return err
161161
}
162162
var (
163-
msg = ethereum.CallMsg{From: opts.From, To: &c.address, Data: input}
163+
msg = parallax.CallMsg{From: opts.From, To: &c.address, Data: input}
164164
ctx = ensureContext(opts.Context)
165165
code []byte
166166
output []byte
@@ -338,7 +338,7 @@ func (c *BoundContract) estimateGasLimit(opts *TransactOpts, contract *common.Ad
338338
return 0, ErrNoCode
339339
}
340340
}
341-
msg := ethereum.CallMsg{
341+
msg := parallax.CallMsg{
342342
From: opts.From,
343343
To: contract,
344344
GasPrice: gasPrice,
@@ -419,7 +419,7 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]any
419419
// Start the background filtering
420420
logs := make(chan types.Log, 128)
421421

422-
config := ethereum.FilterQuery{
422+
config := parallax.FilterQuery{
423423
Addresses: []common.Address{c.address},
424424
Topics: topics,
425425
FromBlock: new(big.Int).SetUint64(opts.Start),
@@ -467,7 +467,7 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]any)
467467
// Start the background filtering
468468
logs := make(chan types.Log, 128)
469469

470-
config := ethereum.FilterQuery{
470+
config := parallax.FilterQuery{
471471
Addresses: []common.Address{c.address},
472472
Topics: topics,
473473
}

accounts/abi/bind/base_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525
"testing"
2626

27-
ethereum "github.com/microstack-tech/parallax"
27+
"github.com/microstack-tech/parallax"
2828
"github.com/microstack-tech/parallax/accounts/abi"
2929
"github.com/microstack-tech/parallax/accounts/abi/bind"
3030
"github.com/microstack-tech/parallax/common"
@@ -67,7 +67,7 @@ func (mt *mockTransactor) SuggestGasTipCap(ctx context.Context) (*big.Int, error
6767
return mt.gasTipCap, nil
6868
}
6969

70-
func (mt *mockTransactor) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error) {
70+
func (mt *mockTransactor) EstimateGas(ctx context.Context, call parallax.CallMsg) (gas uint64, err error) {
7171
return 0, nil
7272
}
7373

@@ -89,7 +89,7 @@ func (mc *mockCaller) CodeAt(ctx context.Context, contract common.Address, block
8989
return mc.codeAtBytes, mc.codeAtErr
9090
}
9191

92-
func (mc *mockCaller) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
92+
func (mc *mockCaller) CallContract(ctx context.Context, call parallax.CallMsg, blockNumber *big.Int) ([]byte, error) {
9393
mc.callContractBlockNumber = blockNumber
9494
return mc.callContractBytes, mc.callContractErr
9595
}
@@ -109,7 +109,7 @@ func (mc *mockPendingCaller) PendingCodeAt(ctx context.Context, contract common.
109109
return mc.pendingCodeAtBytes, mc.pendingCodeAtErr
110110
}
111111

112-
func (mc *mockPendingCaller) PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error) {
112+
func (mc *mockPendingCaller) PendingCallContract(ctx context.Context, call parallax.CallMsg) ([]byte, error) {
113113
mc.pendingCallContractCalled = true
114114
return mc.pendingCallContractBytes, mc.pendingCallContractErr
115115
}

accounts/abi/bind/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"errors"
2222
"time"
2323

24-
ethereum "github.com/microstack-tech/parallax"
24+
"github.com/microstack-tech/parallax"
2525
"github.com/microstack-tech/parallax/common"
2626
"github.com/microstack-tech/parallax/core/types"
2727
"github.com/microstack-tech/parallax/log"
@@ -40,7 +40,7 @@ func WaitMined(ctx context.Context, b DeployBackend, tx *types.Transaction) (*ty
4040
return receipt, nil
4141
}
4242

43-
if errors.Is(err, ethereum.NotFound) {
43+
if errors.Is(err, parallax.ErrNotFound) {
4444
logger.Trace("Transaction not yet mined")
4545
} else {
4646
logger.Trace("Receipt retrieval failed", "err", err)

accounts/abi/method.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
// signature and no receive function is specified.
3636
Fallback
3737
// Receive represents the receive function.
38-
// This function is executed on plain Ether transfers.
38+
// This function is executed on plain Parallax transfers.
3939
Receive
4040
// Function represents a normal function.
4141
Function
@@ -162,7 +162,7 @@ func (method Method) IsConstant() bool {
162162
}
163163

164164
// IsPayable returns the indicator whether the method can process
165-
// plain ether transfers.
165+
// plain laxes transfers.
166166
func (method Method) IsPayable() bool {
167167
return method.StateMutability == "payable" || method.Payable
168168
}

accounts/accounts.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
// Package accounts implements high level Ethereum account management.
17+
// Package accounts implements high level Parallax account management.
1818
package accounts
1919

2020
import (
2121
"fmt"
2222
"math/big"
2323

24-
ethereum "github.com/microstack-tech/parallax"
24+
"github.com/microstack-tech/parallax"
2525
"github.com/microstack-tech/parallax/common"
2626
"github.com/microstack-tech/parallax/core/types"
2727
"github.com/microstack-tech/parallax/event"
2828
"golang.org/x/crypto/sha3"
2929
)
3030

31-
// Account represents an Ethereum account located at a specific location defined
31+
// Account represents an Parallax account located at a specific location defined
3232
// by the optional URL field.
3333
type Account struct {
34-
Address common.Address `json:"address"` // Ethereum account address derived from the key
34+
Address common.Address `json:"address"` // Parallax account address derived from the key
3535
URL URL `json:"url"` // Optional resource locator within a backend
3636
}
3737

@@ -98,7 +98,7 @@ type Wallet interface {
9898
//
9999
// You can disable automatic account discovery by calling SelfDerive with a nil
100100
// chain state reader.
101-
SelfDerive(bases []DerivationPath, chain ethereum.ChainStateReader)
101+
SelfDerive(bases []DerivationPath, chain parallax.ChainStateReader)
102102

103103
// SignData requests the wallet to sign the hash of the given data
104104
// It looks up the account specified either solely via its address contained within,
@@ -119,7 +119,7 @@ type Wallet interface {
119119
SignDataWithPassphrase(account Account, passphrase, mimeType string, data []byte) ([]byte, error)
120120

121121
// SignText requests the wallet to sign the hash of a given piece of data, prefixed
122-
// by the Ethereum prefix scheme
122+
// by the Parallax prefix scheme
123123
// It looks up the account specified either solely via its address contained within,
124124
// or optionally with the aid of any location metadata from the embedded URL field.
125125
//

accounts/external/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"math/big"
2222
"sync"
2323

24-
ethereum "github.com/microstack-tech/parallax"
24+
"github.com/microstack-tech/parallax"
2525
"github.com/microstack-tech/parallax/accounts"
2626
"github.com/microstack-tech/parallax/common"
2727
"github.com/microstack-tech/parallax/common/hexutil"
@@ -148,7 +148,7 @@ func (api *ExternalSigner) Derive(path accounts.DerivationPath, pin bool) (accou
148148
return accounts.Account{}, fmt.Errorf("operation not supported on external signers")
149149
}
150150

151-
func (api *ExternalSigner) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader) {
151+
func (api *ExternalSigner) SelfDerive(bases []accounts.DerivationPath, chain parallax.ChainStateReader) {
152152
log.Error("operation SelfDerive not supported on external signers")
153153
}
154154

0 commit comments

Comments
 (0)