Commit 30f3027b authored by Tien Nguyen's avatar Tien Nguyen Committed by GitHub

op-plasma: a litle fixed missing error check and godoc (#10587)

parent df5add3b
...@@ -103,7 +103,7 @@ func (c *DAClient) setInputWithCommit(ctx context.Context, comm CommitmentData, ...@@ -103,7 +103,7 @@ func (c *DAClient) setInputWithCommit(ctx context.Context, comm CommitmentData,
return nil return nil
} }
// setInputs sets the input data and reads the respective DA generated commitment. // setInput sets the input data and reads the respective DA generated commitment.
func (c *DAClient) setInput(ctx context.Context, img []byte) (CommitmentData, error) { func (c *DAClient) setInput(ctx context.Context, img []byte) (CommitmentData, error) {
if len(img) == 0 { if len(img) == 0 {
return nil, ErrInvalidInput return nil, ErrInvalidInput
......
...@@ -95,7 +95,7 @@ func NewPlasmaDAWithStorage(log log.Logger, cfg Config, storage DAStorage, metri ...@@ -95,7 +95,7 @@ func NewPlasmaDAWithStorage(log log.Logger, cfg Config, storage DAStorage, metri
} }
} }
// NewPlasmaWithState creates a plasma storage from initial state used for testing in isolation. // NewPlasmaDAWithState creates a plasma storage from initial state used for testing in isolation.
// We pass the L1Fetcher to each method so it is kept in sync with the conf depth of the pipeline. // We pass the L1Fetcher to each method so it is kept in sync with the conf depth of the pipeline.
func NewPlasmaDAWithState(log log.Logger, cfg Config, storage DAStorage, metrics Metricer, state *State) *DA { func NewPlasmaDAWithState(log log.Logger, cfg Config, storage DAStorage, metrics Metricer, state *State) *DA {
return &DA{ return &DA{
...@@ -410,10 +410,13 @@ func DecodeChallengeStatusEvent(log *types.Log) (*bindings.DataAvailabilityChall ...@@ -410,10 +410,13 @@ func DecodeChallengeStatusEvent(log *types.Log) (*bindings.DataAvailabilityChall
// DecodeResolvedInput decodes the preimage bytes from the tx input data. // DecodeResolvedInput decodes the preimage bytes from the tx input data.
func DecodeResolvedInput(data []byte) ([]byte, error) { func DecodeResolvedInput(data []byte) ([]byte, error) {
dacAbi, _ := bindings.DataAvailabilityChallengeMetaData.GetAbi() dacAbi, err := bindings.DataAvailabilityChallengeMetaData.GetAbi()
if err != nil {
return nil, err
}
args := make(map[string]interface{}) args := make(map[string]interface{})
err := dacAbi.Methods["resolve"].Inputs.UnpackIntoMap(args, data[4:]) err = dacAbi.Methods["resolve"].Inputs.UnpackIntoMap(args, data[4:])
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
package plasma package plasma
// Max input size ensures the canonical chain cannot include input batches too large to // MaxInputSize ensures the canonical chain cannot include input batches too large to
// challenge in the Data Availability Challenge contract. Value in number of bytes. // challenge in the Data Availability Challenge contract. Value in number of bytes.
// This value can only be changed in a hard fork. // This value can only be changed in a hard fork.
const MaxInputSize = 130672 const MaxInputSize = 130672
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment