Skip to content

ERN spec #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Jul 31, 2025
Merged

ERN spec #149

merged 44 commits into from
Jul 31, 2025

Conversation

alecsavvy
Copy link
Contributor

@alecsavvy alecsavvy commented Jul 17, 2025

  • Builds upon the release ddex that @phelpsdb implemented. Introduces full 4.3 ddex compatible protobuf schemas for ERN, MEAD, and PIE with a couple custom MEAD fields that are present in entity manager.
  • Comments out some of the stream upload test as a lot of this will change with signed upload/stream urls and access control ddex extensions.
  • Adds a new ddex integration test that submits an ERN, PIE, MEAD, and gathers these back via addresses.
  • This PR doesn't add any special access controls or entity management yet, this is raw DDEX akin to the style of entity manager at the moment.
  • Adds a new TransactionV2 type which is better structured for what we need in the future. Various signing methods, Envelope pattern, expirations, etc.

@alecsavvy alecsavvy self-assigned this Jul 17, 2025
// address of the party sending the message, must match the recovered address from the signature
string from = 2;
// address of the party receiving the message, must be empty for new release messages
string to = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make as a message type

}

func (s *Server) finalizeERNNewMessage(ctx context.Context, req *abcitypes.FinalizeBlockRequest, txhash string, messageIndex int64, ern *v1beta2.ElectronicReleaseNotification) error {
nonce := fmt.Sprintf("%d", ern.Header.Nonce)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Sprint

Copy link
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing blocking for me. it is a lot to grok, but with the right entrypoint, it's pretty easy to follow. tests helped a lot

"google.golang.org/protobuf/proto"
)

func keccak256(data []byte) []byte {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this helper, you can use go-ethereum

import (
"github.com/ethereum/go-ethereum/crypto"
)

and just call

hash := crypto.Keccak256(message)

@@ -3,6 +3,7 @@ package pages
import (
"encoding/json"
v1 "github.com/AudiusProject/audiusd/pkg/api/core/v1"
v1beta1 "github.com/AudiusProject/audiusd/pkg/api/core/v1beta1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of a nit, but i don't love the v1beta nomenclature. it's just going to to be hard to change in the future. why not call it something more generic , like ddex or wire_protocol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my vote is ddex, so just remove the subpackage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockHeight int64
}

type CorePie struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love me a slice of that core pie

@@ -169,6 +185,31 @@ type CoreEtlTxValidatorRegistration struct {
CreatedAt pgtype.Timestamptz
}

type CoreMead struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drink drank drunk

create index if not exists idx_core_ern_message_control_type on core_ern (message_control_type);
create index if not exists idx_core_ern_sender on core_ern (sender);

create index if not exists idx_core_ern_party_addresses_gin on core_ern using gin (party_addresses);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these gin indexes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they were added in a previous version to support querying the text[] columns, i can remove them until we decide on a path forward there

return ErrV2TransactionExpired
}

// TODO: check signature
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this todo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EIP 712 isn't implemented nor agreed upon yet, this is where that logic check would go

Signature: sig,
DataHash: sigData,
Data: data,
// create ERN track release with upload cid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand why we deleted the old tests, those should still work right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see now, it's b/c you removed the impl of that method for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and signed stream urls will change this entirely. this test doesn't test any relevant functionality for us yet

},
})
ernReceipt := submitRes.Msg.TransactionReceipt.MessageReceipts[0].GetErnAck()
require.NotNil(t, ernReceipt, "failed to get ern ack")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we assert more here? like the address that gets generated? that should be deterministic right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of, we don't know which block this ERN will be included in so we can guess but not predict.

Nonce: "4",
Expiration: time.Now().Add(time.Hour).Unix(),
},
Messages: []*corev1beta1.Message{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a great test

},
},
{
PartyReference: "P_ARTIST_5189",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛈️ ⛈️ ⛈️ ⛈️ ⛈️ ⛈️

@alecsavvy alecsavvy merged commit 1602ffe into main Jul 31, 2025
4 checks passed
@alecsavvy alecsavvy deleted the as/ddex-e2e branch July 31, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants