Skip to content

Commit 0788d9f

Browse files
committed
dynamically add all md to menu
1 parent c95d608 commit 0788d9f

File tree

5 files changed

+197
-1962
lines changed

5 files changed

+197
-1962
lines changed

docs/config/gatsby-config.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
// Function to get markdown files and create menu links
5+
function getMenuLinksFromDocs() {
6+
const docsPath = path.join(__dirname, 'src/docs');
7+
const menuLinks = [];
8+
9+
try {
10+
const files = fs.readdirSync(docsPath);
11+
files.forEach(file => {
12+
if (file.endsWith('.md') || file.endsWith('.mdx')) {
13+
const name = file.replace(/\.(md|mdx)$/, '').replace(/-/g, ' ');
14+
const link = `/${file.replace(/\.(md|mdx)$/, '')}`;
15+
menuLinks.push({
16+
name: name.charAt(0).toUpperCase() + name.slice(1),
17+
link: link
18+
});
19+
}
20+
});
21+
} catch (error) {
22+
console.warn('Could not read docs directory:', error.message);
23+
}
24+
25+
return menuLinks;
26+
}
27+
128
module.exports = {
229
pathPrefix: "/execution-apis",
330
siteMetadata: {
@@ -10,15 +37,12 @@ module.exports = {
1037
primaryColor: '#3f51b5', //material-ui primary color
1138
secondaryColor: '#f50057', //material-ui secondary color
1239
author: '',
13-
menuLinks: [ {
14-
name: 'Contributors Guide',
15-
link: '/making-changes',
16-
ignoreNextPrev: true
17-
},
40+
menuLinks: [
1841
{
1942
name: 'API Documentation',
2043
link: '/api-documentation'
21-
}
44+
},
45+
...getMenuLinksFromDocs() // This will add all markdown files
2246
],
2347
footerLinks: [
2448
{
File renamed without changes.

docs/reference/making-changes.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Contributors Guide
2+
3+
This guide will explain for new and experienced contributors alike how to
4+
propose changes to Ethereum JSON-RPC API.
5+
6+
## Introduction
7+
8+
The Ethereum JSON-RPC API is the canonical interface between users and the
9+
Ethereum network. Each execution layer client implements the API as defined by
10+
the spec.
11+
12+
As the main source of chain information, anything that is not provided over via
13+
API will not be easily accessible to users.
14+
15+
## Guiding Principles
16+
17+
When considering a change to the API, it's important to keep a few guiding
18+
principles in mind.
19+
20+
### Necessity
21+
22+
The most common path to a newly standardized method is necessity. As the
23+
protocol changes over time, new types of data become available. EIP-2930
24+
necessitated the introduction of `eth_accessList` and EIP-1559 necessitated
25+
`eth_feeHistory`.
26+
27+
Therefore, a good question to ask before making a new API proposal is whether
28+
or not the method is strictly necessary. Sometimes the answer is yes even
29+
without a protocol change. For example, `eth_getProof` has been possible since
30+
the initial version of Ethereum -- yet, it was only standardized in recent years
31+
as demand for the functionality grew. Before `eth_getProof`, there was no
32+
interface for getting intermediary trie nodes over the API. This is a great
33+
example of a method that became more necessary over time.
34+
35+
Sometimes efficiency is the basis of necessity. If certain patterns of requests
36+
becomes popular, it can be advantageous to enshrine the behavior into the API.
37+
38+
### Implementation Complexity
39+
40+
How a method is implemented should be carefully considered before proposing a
41+
change to the API. Although each client is able to validate the Ethereum chain,
42+
there can be a huge variance in actual design decisions.
43+
44+
As an example, a proposal for a method such as `eth_totalSupply` seems
45+
reasonable. This is a quantity that users are often interested in and it would
46+
be nice to have it available. However, tracking the total supply is tricky. There
47+
are several avenues where ether can enter and leave supply. This method would
48+
need to either i) compute the value on demand or ii) store value for each block
49+
height.
50+
51+
Option i) is out, because it would involve executing each block starting with
52+
genesis. Option ii) is viable, but it starts enforcing certain requirements on
53+
clients beyond being able to simply validate the chain. Now during block
54+
ingestion, each client needs to store in their database the supply for that
55+
height. The chain reorg logic also needs to consider this new data. It is not
56+
trivial.
57+
58+
### Backwards Compatibility
59+
60+
There is currently no accepted path to making backwards incompatible changes to
61+
the API. This means that proposals which change syntax or semantics of existing
62+
methods are unlikely to be accepted. A more viable approach is to propose a new
63+
method be created.
64+
65+
## Standardization
66+
67+
There is no formal process for standardization of API changes. However, the
68+
outline below should give proposal authors and champions a rough process to
69+
follow.
70+
71+
### Idea
72+
73+
An often overlooked aspect of the standardization journey is the idea phase.
74+
This is an important period of time, because some focused effort at this point
75+
in time can save time and make the rest of the process much smoother.
76+
77+
During the idea phase, it is recommended to contemplate the proposal idea in
78+
the context of the guiding principles above. It's also good to get feedback on
79+
the idea in the open. Just one or two rough acknowledgements from client
80+
developers that an idea makes sense and is worth pursuing can avoid wasting a
81+
lot of time formalizing a proposal that has little chance of being accepted.
82+
83+
### Proposal
84+
85+
The formal proposal stage is where the bulk of time will be spent. A formal
86+
proposal is a PR to this repository ([ethereum/execution-apis][exec-apis]). A
87+
good proposal will have the following:
88+
89+
* a modification to the specification implementing the proposal
90+
* test cases for proposal ([guide][test-gen])
91+
* motivation for the change
92+
* links to acknowledgements that proposal idea is sound
93+
* clear rationale for non-obvious design decisions
94+
95+
### Acquiring Support
96+
97+
Once a formal proposal has been created, formal support of clients can be
98+
acquired. This has historically been done via the AllCoreDevs call. It is
99+
recommended to post a request on the AllCoreDevs agenda (usually in
100+
[ethereum/pm][pm]) to discuss the proposal, at which point formal support can
101+
be ascertained.
102+
103+
Oftentimes, support will be conditional on certain changes. This means that
104+
proposals will cycle between formal proposal work and earning support from
105+
clients. This should be expected and not discourage authors.
106+
107+
### Accepting the Change
108+
109+
After client teams acknowledge and accept the change, it is usually on them to
110+
implement the method in their client. Due to the lack of versioning of the API,
111+
it is preferable that clients release the method roughly at the same time so
112+
that there is not much time when some clients support certain methods and
113+
others don't.
114+
115+
116+
[exec-apis]: https://github.com/ethereum/execution-apis
117+
[pm]: https://github.com/ethereum/pm
118+
[test-gen]: https://github.com/ethereum/execution-apis/blob/main/tests/README.md

0 commit comments

Comments
 (0)