New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

headlong: A Contract ABI and RLP Library for the JVM by Evan Saulpaugh | Devcon Bogotá

DevconSat, Oct 7, 2023, 12:00 AM

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more. https://archive.devcon.org/archive/watch/6/headlong-a-contract-abi-and-rlp-library-for-the-jvm/ I describe how I implemented the solidity Contract ABI specification to make encoding and decoding faster and therefore more scaleable while also improving usability. headlong can parse any function signature or JSON description at runtime and do the type-checking of inputs before encoding and of outputs during decoding. I also discuss how the command-line interface uses human-to-machine and machine-to-machine RLP-based serialization formats to consume arguments and produce results. Speaker(s): Evan Saulpaugh Track: Developer Infrastructure Keywords: developers,developers,developers Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

Transcript

foreign [Music] Library it uh it doesn't do anything else really it's just hyper focused it's used by Dune Unstoppable domains I figured that uh I wanted to make a general Solution that's like low level high performance that people can just build stuff on here's some just rough benchmarks for my laptop um you can do like partial decoding of uh call data for ABI so that's like the measured nanoseconds over there so it works with bytes instead of strings so it's a lot faster than uh some other tools so yeah just very few dependencies supposed to be lightweight it's just sort of uh the general design philosophy around it and yeah Java so it does compatible with Android and kotlin and um it's like if you're using it on like a web server using decoding large amounts of data this is useful for something like that the other type of user I have is um like people are trying to work with like an array of structs inside a struct and like other tools aren't working for them so uh like mine can decode any arbitrary function signature or data that matches any function signature so here's the API for like the rlp stuff this is different because uses an iterator pattern and it decodes on demand instead of uh eagerly yeah all these objects just sort of point at uh at a bite buffer and uh you can decode directly from the byte buffer on demand and so it saves some time there and then here's like the ABI stuff so all the objects are meant to be reused many times like the function object and they're stateless so you can share them across threads or between code there's some decoding it also deals with Json so you can like parse Json and create a function from Json uh it also does event decoding as added recently um so just hear some details on you know how I got the performance benefits from you know using byte buffer and pre-calculating things and and holding on to them for like multiple encodings and decodings yeah and there's some denial of service protection for if you're decoding like untrusted data that wants to allocate like a huge array it'll throw an exception instead of like allocating a gigabyte of uh memory yeah future work might involve um doing like more partial decodes like querying like nested tuples so like going to a specific index and then if that's a tuple go ahead and index and that and just pick out the thing you want to decode and just ignore everything else um but it requires like jumping around um the index and stuff and then yeah I've been talking to some people recently about a possible ABI V3 so um like I wrote a command line interface that can encode arguments as rlp and uses a lot less uh bytes because you don't have an offset and all this zero padding and stuff like that so and then you can try that out if you want headlong clis like the command line interface and uh yeah faster simpler software Legos I kind of just want people to uh you know be able to build um modular stuff just so that you're not like weighted down by all these dependencies and like complex Frameworks where you have to read all this documentation and um just build something to last and then special thanks to Victor dylapine because uh he added some code that now I can decode events with headlong and thanks do you have any plans for SSD support uh not right now I thought about maybe implementing something separate for SSE but uh I don't know if I'm gonna so maybe what does he uh good use cases for this Library I'll do an analytics uh start using it for like ingesting large amounts of data so they can put it into databases and like query it so like if you have a lot of historical data lying around do you want to decode like huge amounts of it and gain insights from data and stuff otherwise it's just designed to work in every possible case nested arrays nested tuples tubular Rays drugs and stuff oh and there's no code generation so it's all just very uh traditional that way

Automatic transcript — names and jargon may be misspelled.