chore: Update Lane Specific Readmes (#254)
* nits * e2e shorter testing time
This commit is contained in:
@@ -17,27 +17,24 @@ type (
|
||||
Txs [][]byte
|
||||
// Cache is a cache of the selected transactions in the proposal.
|
||||
Cache map[string]struct{}
|
||||
// TxEncoder is the transaction encoder.
|
||||
TxEncoder sdk.TxEncoder
|
||||
// Info contains information about the state of the proposal.
|
||||
Info types.ProposalInfo
|
||||
}
|
||||
)
|
||||
|
||||
// NewProposalWithContext returns a new empty proposal.
|
||||
func NewProposalWithContext(logger log.Logger, ctx sdk.Context, txEncoder sdk.TxEncoder) Proposal {
|
||||
func NewProposalWithContext(ctx sdk.Context, logger log.Logger) Proposal {
|
||||
maxBlockSize, maxGasLimit := GetBlockLimits(ctx)
|
||||
return NewProposal(logger, txEncoder, maxBlockSize, maxGasLimit)
|
||||
return NewProposal(logger, maxBlockSize, maxGasLimit)
|
||||
}
|
||||
|
||||
// NewProposal returns a new empty proposal. Any transactions added to the proposal
|
||||
// will be subject to the given max block size and max gas limit.
|
||||
func NewProposal(logger log.Logger, txEncoder sdk.TxEncoder, maxBlockSize int64, maxGasLimit uint64) Proposal {
|
||||
func NewProposal(logger log.Logger, maxBlockSize int64, maxGasLimit uint64) Proposal {
|
||||
return Proposal{
|
||||
Logger: logger,
|
||||
TxEncoder: txEncoder,
|
||||
Txs: make([][]byte, 0),
|
||||
Cache: make(map[string]struct{}),
|
||||
Logger: logger,
|
||||
Txs: make([][]byte, 0),
|
||||
Cache: make(map[string]struct{}),
|
||||
Info: types.ProposalInfo{
|
||||
TxsByLane: make(map[string]uint64),
|
||||
MaxBlockSize: maxBlockSize,
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
lane.On("GetMaxBlockSpace").Return(math.LegacyNewDec(1)).Maybe()
|
||||
|
||||
t.Run("can update with no transactions", func(t *testing.T) {
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), nil, 100, 100)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), 100, 100)
|
||||
|
||||
err := proposal.UpdateProposal(lane, nil)
|
||||
require.NoError(t, err)
|
||||
@@ -64,7 +64,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0])
|
||||
gasLimit := 100
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit))
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), uint64(gasLimit))
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
@@ -113,7 +113,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
gasLimit += 100
|
||||
}
|
||||
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), gasLimit)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), gasLimit)
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo(txs)
|
||||
require.NoError(t, err)
|
||||
@@ -153,7 +153,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := int64(len(txBzs[0]))
|
||||
gasLimit := uint64(100)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), size, gasLimit)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), size, gasLimit)
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
@@ -219,7 +219,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0]) + len(txBzs[1])
|
||||
gasLimit := 200
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit))
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), uint64(gasLimit))
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
@@ -263,7 +263,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0])
|
||||
gasLimit := 100
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit))
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), uint64(gasLimit))
|
||||
|
||||
lane := mocks.NewLane(t)
|
||||
|
||||
@@ -304,7 +304,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0])
|
||||
gasLimit := 100
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit))
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), uint64(gasLimit))
|
||||
|
||||
lane := mocks.NewLane(t)
|
||||
|
||||
@@ -345,7 +345,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0])
|
||||
gasLimit := 100
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size)-1, uint64(gasLimit))
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size)-1, uint64(gasLimit))
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
@@ -381,7 +381,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
|
||||
size := len(txBzs[0])
|
||||
gasLimit := 100
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)-1)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), int64(size), uint64(gasLimit)-1)
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
@@ -425,7 +425,7 @@ func TestUpdateProposal(t *testing.T) {
|
||||
txBzs, err := utils.GetEncodedTxs(encodingConfig.TxConfig.TxEncoder(), []sdk.Tx{tx, tx2})
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), encodingConfig.TxConfig.TxEncoder(), 10000, 10000)
|
||||
proposal := proposals.NewProposal(log.NewTestLogger(t), 10000, 10000)
|
||||
|
||||
txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx})
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user