diff --git a/CHANGELOG.md b/CHANGELOG.md index a988093..c934eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.0.6] - 2022-10-26 + +### Changed + +- Fixed panic when parsing events modified through authz execution + ## [2.0.5] - 2022-10-25 ### Changed @@ -72,8 +78,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Removed support for zero fee transactions -[Unreleased]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.5...HEAD +[Unreleased]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.6...HEAD +[2.0.6]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.5...v2.0.6 [2.0.5]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.2...v2.0.5 [2.0.2]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/kava-labs/rosetta-kava/compare/v2.0.0...v2.0.1 diff --git a/Dockerfile.mainnet b/Dockerfile.mainnet index 0b1319e..ff967d7 100644 --- a/Dockerfile.mainnet +++ b/Dockerfile.mainnet @@ -43,7 +43,7 @@ RUN cd kava \ && mkdir -p /app/cosmovisor/upgrades/v0.19.0/bin \ && mv /go/bin/kava /app/cosmovisor/upgrades/v0.19.0/bin -ARG kava_rosetta_version=v2.0.5 +ARG kava_rosetta_version=v2.0.6 ENV KAVA_ROSETTA_VERSION=$kava_rosetta_version RUN git clone https://github.com/Kava-Labs/rosetta-kava.git \ diff --git a/Dockerfile.testnet b/Dockerfile.testnet index f25acac..0eb86dc 100644 --- a/Dockerfile.testnet +++ b/Dockerfile.testnet @@ -75,7 +75,7 @@ RUN cd kava \ && mkdir -p /app/cosmovisor/upgrades/v0.19.5-testnet/bin \ && mv /go/bin/kava /app/cosmovisor/upgrades/v0.19.5-testnet/bin -ARG kava_rosetta_version=v2.0.4-testnet +ARG kava_rosetta_version=v2.0.6 ENV KAVA_ROSETTA_VERSION=$kava_rosetta_version RUN git clone https://github.com/Kava-Labs/rosetta-kava.git \ diff --git a/kava/operations.go b/kava/operations.go index 8d88cf9..9e50560 100644 --- a/kava/operations.go +++ b/kava/operations.go @@ -339,13 +339,25 @@ func msgMultiSendToTransferOperations(msg *banktypes.MsgMultiSend, status *strin } func unflattenEvents(ev sdk.StringEvent, eventType string, numAttributes int) (events sdk.StringEvents) { - if len(ev.Attributes)%numAttributes != 0 { - panic(fmt.Sprintf("unexpected number of attributes in transfer event %s", ev.Attributes)) + // drop authz_msg_index additions + attributes := []sdk.Attribute{} + for _, attribute := range ev.Attributes { + // remove authz_msg_index attributes + if attribute.Key == "authz_msg_index" { + continue + } + + attributes = append(attributes, attribute) } - numberOfEvents := len(ev.Attributes) / numAttributes + + if len(attributes)%numAttributes != 0 { + panic(fmt.Sprintf("unexpected number of attributes in transfer event %s", attributes)) + } + + numberOfEvents := len(attributes) / numAttributes for i := 0; i < numberOfEvents; i++ { startingIndex := i * numAttributes - event := sdk.NewEvent(eventType, ev.Attributes[startingIndex:startingIndex+numAttributes]...) + event := sdk.NewEvent(eventType, attributes[startingIndex:startingIndex+numAttributes]...) events = append(events, sdk.StringifyEvent(abci.Event(event))) } return events