Skip to content

Commit 7a8f952

Browse files
committed
Clarify some comments
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
1 parent b971489 commit 7a8f952

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

pkg/abi/reverterror.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ func (a ABI) DecodeRevertErrorCtx(ctx context.Context, revertData []byte) *Rever
6262
// Only Error(string) is unwrapped for nesting, because the Solidity
6363
// catch-and-rethrow pattern (string.concat + string(reason)) always
6464
// produces Error(string). Custom errors with string/bytes params that
65-
// also embed error data are not yet handled here.
65+
// also embed error data are not yet handled since there is a high liklihood
66+
//that they are not intended to carry error data.
6667
if e.Name == "Error" && len(cv.Children) == 1 {
6768
if strVal, ok := cv.Children[0].Value.(string); ok {
6869
r.unwrapNested(ctx, a.selectorMap(), strVal, 0)
@@ -97,7 +98,7 @@ func (a ABI) selectorMap() map[selectorKey]*Entry {
9798
}
9899

99100
// unwrapNested scans a decoded string value for an embedded ABI error selector.
100-
// If found, it populates r.Prefix and r.Nested to form the recursive chain.
101+
// If found, it populates r.Prefix and r.Cause to form the recursive chain.
101102
func (r *RevertError) unwrapNested(ctx context.Context, selectors map[selectorKey]*Entry, s string, depth int) {
102103
if depth >= maxRevertErrorDepth {
103104
return
@@ -172,7 +173,7 @@ func (r *RevertError) String() string {
172173

173174
// ErrorString returns the formatted error at this level only, e.g.
174175
// Error("not enough funds") or MyCustomError("0x1234","-100").
175-
// Unlike String(), it does not walk the Nested chain — use it when
176+
// Unlike String(), it does not walk the Cause chain — use it when
176177
// you need the single-level description without recursive unwrapping.
177178
func (r *RevertError) ErrorString() string {
178179
if r == nil {
@@ -191,8 +192,7 @@ func (r *RevertError) Signature() (string, error) {
191192
}
192193

193194
// SerializeJSON serializes the decoded error data at this level using
194-
// the provided Serializer. This is most useful on the Innermost() error
195-
// where the data is cleanly structured.
195+
// the provided Serializer.
196196
func (r *RevertError) SerializeJSON(ctx context.Context, s *Serializer) ([]byte, error) {
197197
if r == nil || r.cv == nil {
198198
return nil, nil
@@ -204,7 +204,7 @@ func (r *RevertError) SerializeJSON(ctx context.Context, s *Serializer) ([]byte,
204204
}
205205

206206
// Cause returns the next error in the chain (one level deeper), or nil
207-
// at the leaf. Analogous to Java's Throwable.getCause().
207+
// at the leaf.
208208
func (r *RevertError) GetCause() *RevertError {
209209
if r == nil {
210210
return nil

0 commit comments

Comments
 (0)